An addressing mode specifies how the operand of an instruction is interpreted — how to find the actual data the instruction will operate on. Different addressing modes offer trade-offs between speed, flexibility and memory usage.
Cambridge 9618 specifies four addressing modes:
#n is loaded directly into ACC. No memory access needed.In immediate addressing, the operand is the actual data value (not an address). The # symbol signals immediate mode. This is the fastest mode — no memory access is needed because the data is embedded in the instruction itself.
Limitation: You can only use a fixed, known constant. If the data is variable or stored in memory, you need a different mode.
In direct addressing, the operand is a memory address, and the CPU fetches the data stored at that address. This is the standard mode for accessing named variables.
In indirect addressing (LDI), the operand is an address that contains another address. The CPU first fetches the address stored at the operand, then uses that second address to fetch the actual data. This is used to implement pointers.
| Step | Action |
|---|---|
| 1 | Read address stored at Mem[PTR] — call it X |
| 2 | Load the value from Mem[X] into ACC |
Use case: Indirect addressing is useful when the address of the data changes at runtime (e.g., implementing a linked list or pointer-based data structure).
In indexed addressing (LDX), the effective address = base address + IX (Index Register). By incrementing IX, you can step through an array element by element without modifying the base address in the instruction.
Array loop pattern: Combine LDX with INC IX and CMP/JPN or JPE to loop through all elements of an array efficiently.
| Mode | Instruction | Source of data | Memory accesses | Use case |
|---|---|---|---|---|
| Immediate | LDM #n | Operand = data | 0 extra | Load a constant |
| Direct | LDD addr | Mem[addr] | 1 | Load a named variable |
| Indirect | LDI addr | Mem[Mem[addr]] | 2 | Pointer / dynamic address |
| Indexed | LDX addr | Mem[addr + IX] | 1 | Array element access |
# means immediate (operand IS the data), no # means direct (operand IS an address), LDI means indirect (two-step lookup), LDX means indexed (add IX to base address).
LDM #5 loads the value 5; LDD 5 loads whatever is stored at memory address 5LDR loads IX (not ACC) — used to initialise the index registerINC ACC instead of INC IX when stepping through an array with indexed addressing7 questions · instantly marked · Cambridge 9618 standard
| Term | Definition |
|---|
10 questions · 10 marks · 10 minutes