Xenia at a computer
Skip to Content

FoxSylv.dev:$ cd _

FoxSylv.dev

~/coding

~/trackmania

~/contact

cd _

~/coding

~/trackmania

~/contact

Fox-0

Instruction Set

The instruction set is divided up into four main classes of instructions. Register numbers are in 4-bit chunks (even though only the least 3 bits have physical registers available for use).

00 [opcode] [reg1] [reg2]

The instruction for passing data through the ALU. Reg2 is overwritten with the result. Below is a list of all accepted opcodes:

  1. 0000 - NOP

  2. 0001 - NOR

  3. 0010 - SUB

  4. 0011 - DEC

  5. 0100 - ADD

  6. 0101 - SHR (by one)

  7. 0110 - XOR

  8. 0111 - NAND

  9. 1000 - AND

  10. 1001 - XNOR

  11. 1010 - ADC (always with CF = 1)

  12. 1011 - NEG

  13. 1100 - INC

  14. 1101 - SAR (by one)

  15. 1110 - OR

  16. 1111 - NOT

11 [reg] [immediate]

Immediates an 8-bit value into the given register.

10 [condition] [target location]

Moves the instruction pointer to the given 8-bit target location if the condition is satisfied. It is strongly recommended to leave three NOP operations after any jump instruction unless you know what you're doing.

  1. 0001 - JZ

  2. 1001 - JNZ

  3. 0010 - JS

  4. 1010 - JNS

  5. 0100 - JC

  6. 1100 - JNC

Notice that the three least significant bits correspond to flags and the leading bit acts as negation. When multiple flags are selected, only one condition needs to be satisfied to jump.

01 0000 [reg1] [reg2] - MOV

01 1111 0000 0000 - HLT

Example Programs

A copy of the ROM used in the showcase is available on ORE (mc.openredstone.org). Collatz starts at address 0x05 and Fibonacci starts at address 0x30. Address 0x01 is a jump that can take the IP directly to the start of Fibonacci with a change in repeater placement (the top repeater at the first ROM address).

Conclusion

This was a fun little project. The showcase was also the first time I actually really TRIED to edit something, and I think it came out alright. I learned a lot about computer logic and architecture during this, and of course got a lot better at redstone. I would recommend trying it if you're interested, because the initial intimidation everyone feels is honestly somewhat unfounded, so long as you continually try to improve. ^w^

  • Favicon by drakonicguy
  • Background Xenia art by Neotheta
  • Footer Xenia art by cathodegaytube
  • Blobfoxes by Volpeon
Xenia the fox linux mascot confidently holding a keyboard