1.4Addressing modes (know EA of each)
The idea
An addressing mode is the rule for turning the number written in the instruction into the actual data it means.
Think of it like this: You are handed a note that says "20". Is 20 the answer itself, a shelf number, or a note pointing to another shelf? The mode tells you.
Why it exists
Programs need constants, variables, pointers, arrays and loops. Different modes make each cheap without extra instructions.
How it works
- Immediate: the number is the operand. Direct: the number is the address of the operand.
- Indirect: the number is the address of the address. Register: the operand lives in a register.
- Indexed / base: add a register to the number. Relative: add PC to the number.
- Count memory references: immediate 0, direct 1, indirect 2.
Worked example: A = 20, M[20] = 40, M[40] = 77
Immediate: operand = 20. Direct: operand = M[20] = 40. Indirect: EA = M[20] = 40, operand = M[40] = 77. Indexed with X = 4: EA = 24, operand = M[24] = 15.
Now play with it
- →Click Immediate, Direct, then Indirect and watch which memory cells light up and how the effective address changes.
- →Try Relative and note that PC is already incremented.
| Address | 20 | 24 | 31 | 40 | 120 |
|---|---|---|---|---|---|
| M[ ] | 40 | 15 | 9 | 77 | 33 |
A = 20, R1 = 40, X = 4, B = 100, PC (already incremented) = 11.
Check yourself
With A = 20, M[20] = 40 and M[40] = 77, what operand does INDIRECT addressing give?
Exam notes (the dense version)
Immediate: operand is in the instruction · Direct: EA = A · Indirect: EA = M[A] · Register: operand = R · Reg-indirect: EA = R · Indexed: EA = A + X · Base-register: EA = A + B · Relative: EA = PC + A (PC already points to the next instr) · Auto-inc/dec: EA = R, then R±=size · Stack: implicit SP.
Previous year questions: Instruction Formats & Addressing Modes (12)
PYQs are grouped by topic, so this is the full set for Instruction Formats & Addressing Modes; try the ones that match this subtopic. Open all 12 on the topic page.