IndexRegister (IX)
Inputs
| Pin | Type | Description |
|---|---|---|
| Data | bus8 | Input value to load (8 bits) |
| Clock | bit | Clock signal |
| WE | bit | Write Enable: 1 = load Data into IX |
| Inc | bit | Increment: 1 = add 1 to current value |
Outputs
| Pin | Type | Description |
|---|---|---|
| Q | bus8 | Current value stored in the index register |
How It Works
On the rising edge of Clock (0→1), the IndexRegister performs one of two actions:
- If Inc = 1: the stored value is incremented by 1 (Q = Q + 1).
- Else if WE = 1: the Data input is loaded into the register (Q = Data).
Priority: Inc takes precedence over WE. If both are 1 on the same clock edge, IX increments rather than loading new data.
Corresponding assembler instructions:
LDX— load IX from a value (sets WE=1, loads Data)INX— increment IX by 1 (sets Inc=1)LDAX— load accumulator indirectly: Acc = RAM[IX]STAX— store accumulator indirectly: RAM[IX] = Acc
Usage
Used in levels 21–29 for indirect addressing. The IndexRegister holds a memory address. LDAX and STAX instructions use IX as a pointer into RAM, enabling array iteration and data structure access without hardcoded addresses.
Example: to iterate through an array at addresses 16–25, load IX with 16 (LDX), process RAM[IX] (LDAX), increment IX (INX), and repeat until IX reaches 26.