2.1 What Is an Addressing Mode?
An addressing mode is the rule that tells the CPU how to interpret the address field of an instruction to find the operand. The Effective Address (EA) is the final memory address of the operand after applying that rule.
Why so many modes? Each mode is a hardware answer to a software pattern: arrays need indexing, pointers need register indirect, loops need auto-increment, position-independent code needs relative, constants need immediate. Knowing which pattern each mode serves is what separates an advanced answer from a definition dump.
2.2 The Complete Mode Catalogue
| Mode | EA Rule | Operand | Typical Use |
|---|---|---|---|
| Implied | none | Implicit in opcode (e.g., CMA complements AC) | Accumulator/stack ops |
| Immediate | none | Inside the instruction itself | Constants (MVI A, 05) |
| Direct (absolute) | EA = address field | M[EA] | Global variables |
| Indirect | EA = M[address field] | M[EA] | Pointers in memory |
| Register | none | In register R | Fast scratch values |
| Register Indirect | EA = content of R | M[EA] | Pointer in a register |
| Auto-increment | EA = R, then R ← R + 1 | M[EA] | Stepping through arrays |
| Auto-decrement | R ← R − 1 first, EA = R | M[EA] | Stack-like traversal |
| Relative | EA = PC + address field | M[EA] | Branches, position-independent code |
| Indexed | EA = XR + address field | M[EA] | Array element: base in instruction, index in XR |
| Base register | EA = BR + address field | M[EA] | Relocation: base in BR, displacement in instruction |
Indexed vs base register — the classic confusion: structurally identical (register + constant), but in indexed mode the address field holds the array's start and the register holds the moving index; in base mode the register holds the segment start and the field holds a fixed offset. The distinction is usage, and examiners ask exactly that.
2.3 The Standard Worked Example (Learn This Cold)
A two-word instruction "load to AC" sits at addresses 200–201; word 201 holds the address field 500. Registers: PC = 200, R1 = 400, XR = 100. Memory: M[399] = 450, M[400] = 700, M[500] = 800, M[600] = 900, M[702] = 325, M[800] = 300.
After fetching both words, PC = 202 (this is the value used for relative mode — the #1 exam trap).
| Mode | EA Calculation | EA | AC Gets |
|---|---|---|---|
| Direct | EA = 500 | 500 | M[500] = 800 |
| Immediate | operand is word 201 | 201 | 500 itself |
| Indirect | EA = M[500] = 800 | 800 | M[800] = 300 |
| Relative | EA = PC + 500 = 202 + 500 | 702 | M[702] = 325 |
| Indexed | EA = XR + 500 = 100 + 500 | 600 | M[600] = 900 |
| Register | operand in R1 | — | 400 |
| Register Indirect | EA = R1 = 400 | 400 | M[400] = 700 |
| Auto-increment | EA = R1 = 400, then R1 ← 401 | 400 | M[400] = 700 |
| Auto-decrement | R1 ← 399 first, EA = 399 | 399 | M[399] = 450 |
Digit check for relative mode: 202 + 500 → 2+0 = 2 (units), 0+0 = 0 (tens), 2+5 = 7 (hundreds) → 702.
2.4 Traps and "Why" Points Examiners Reward
- Relative mode uses the updated PC (after the fetch of the full instruction), not the instruction's own address. Using 200 instead of 202 costs the whole numerical.
- Auto-decrement decrements before the access; auto-increment increments after. The asymmetry exists so the pair can implement PUSH/POP on a memory stack.
- Indirect mode costs one extra memory read — questions on instruction timing must count it.
- Immediate mode has no EA — writing "EA = 201" earns partial credit only if you explain that 201 is where the operand resides, not a computed EA.
- One instruction set can combine modes (e.g., indexed + indirect); compute strictly in the order the mode definition states.
🎯 Exam Focus
- Define effective address. Explain any eight addressing modes with one practical use each.
- Using the standard setup of Section 2.3 but with address field 350, XR = 200, PC after fetch = 302, M[350] = 4000, M[550] = 25, M[652] = 66, M[4000] = 91: compute the operand loaded in direct, indirect, relative, indexed and immediate modes.
- Differentiate indexed addressing from base-register addressing. Why do both exist?
- Which addressing modes require zero, one and two memory references for the operand? Tabulate.
- Show how auto-increment and auto-decrement modes implement POP and PUSH on a stack that grows toward lower addresses.
- A branch instruction at address 750 (one word) uses relative mode with offset −53. What is the branch target?