Register - HenryLoenwind/4bit GitHub Wiki

Registers

The CPU has 16 registers, R00 to R15. A number of them have special aliases:

  • R00: ACC, LOS
  • R07: ADR0
  • R08: ADR1
  • R09: STS
  • R10: R0A, UP
  • R11: R0B, DOWN
  • R12: R0C, NORTH
  • R13: R0D, SOUTH
  • R14: R0E, WEST
  • R15: R0F, EAST

All registers are 4 bit wide.

The combination of ADR0 and ADR1 is known as ADR. ADR cannot be used directly, but a number of opcodes operate on it implicitly.

The instruction pointer (IP) is not a register.

Registers can be mapped to hardware IOs by the runtime environment. Input and output can be mapped separately, so reading back a written value is not guaranteed in this case.