Registers

ECLair has 4 general-purpose registers, named A through D. In addition, there are several other registers used to control the CPU itself, and some accessible only from within microcode to handle internal system functions.

General Purpose Registers

  • 4 general purpose registers: A, B, C, and D
    • Also accessible as 8-bit halves AL, AH, BL, BH, CL, CH, DL, and DH
  • ECLair is load-store architecture, so most operations operate on these registers

Special User-Accessible Registers

  • Program Counter: PC
    • Keeps track of what address in memory is currently being executed.
    • Implemented as a counter, microcode can load the counter from Z or increment the counter
    • From userspace, can modify this using jmp instructions
  • Stack Pointer: SP
    • Keeps track of where the end of the stack currently is.
    • Microcode can do all normal register operations with this, and it’s used for push/pop operations.
    • From userspace, can load/store this like any other register.
  • Page Table Block – PTB
    • Keeps track of which block of the page table we’re currently using. This may get implement as one block per PID once a *NIX port happens, or each process may get more than one block, not sure yet.
    • Microcode and userspace can load this but not read it back
    • Used internally in the paging subsystem to control the page table
  • System Flags and Status – STATUS/FLAGS
    • High byte holds various system flags:
      • Bit 9 – Paging Enabled – PE
      • Bit 8 – Mode – M (Supervisor/User)
      • Bit 7 – Interrupts Enabled – IE
    • Low byte holds various system status bits:
      • Bit 1 – Carry/Overflow – CO
      • Bit 0 – Zero – Z

Internal Microcode Registers

  • IR – Instruction Register
    • Instruction currently being executed is held in this register
    • Microcode loads this as part of the instruction fetch
  • RR – Register Register (a.k.a. IR2)
    • Second byte of the instruction currently being executed is held in this register, if the instruction is a two-byte one
      • Two-byte instructions are ones that affect two different registers
    • Lower nibble is a register specification
    • Upper nibble is currently unused
    • Microcode can use data from this register to specify which register to read
  • MAR – Memory Address Register
    • Memory location being addressed is held in this register
    • Can be loaded from Z or PC, drives the address bus (via the paging subsystem if PE flag is on) during memory read/write operations
  • MDR – Memory Data Register
    • Contents retrieved from memory or contents about to be written to memory are held in this register
    • Can be loaded from Z (for memory writes) or data bus (for memory reads)
    • When loading from data bus, can load either the high or low byte selectively as the data bus is 8 bits and this register is 16
  • RPT – Repeat Register
    • Allows microcode sequences to be executed multiple times
    • Implemented as a counter, can be loaded from Z or decremented, and microcode can branch based on whether RPT=0
  • ALU Input Registers: X, Y
    • 16-bits wide each
    • Microcode loads these as needed from the XY bus
    • ALU is connected to these two registers