Indexed Addressing: The effective address is calculated by adding a base address (provided in the instruction) to the contents of an Index Register (). This is essential for iterating through arrays or lists where the base address is the start of the structure and the index register acts as the offset.
Relative Addressing: The operand is an offset (positive or negative) relative to the current value of the Program Counter (). This allows the program to jump to a nearby instruction, which is critical for implementing loops and conditional branches without hardcoding absolute memory addresses.
| Mode | Operand Meaning | Memory Accesses | Primary Use Case |
|---|---|---|---|
| Immediate | The actual value | 0 | Constants and initializations |
| Direct | Address of the data | 1 | Simple variables |
| Indirect | Address of the address | 2 | Pointers and dynamic data |
| Indexed | Base address (to be offset) | 1 | Arrays and data structures |
| Relative | Offset from current position | 0 (to registers) | Branching and loops |
Identify the Prefix: Always look for symbols like # for immediate values or &/B for specific number bases. If no symbol is present, the operand is usually treated as a memory address (Direct).
Calculate the Effective Address: For Indexed addressing, remember the formula: . Ensure you add the content of the register, not the register number itself.
Trace the Jumps: For Indirect addressing, visualize two steps. If you only perform one memory fetch, you have mistakenly used Direct addressing.
Relative Direction: In Relative addressing, a positive offset moves the execution forward, while a negative offset moves it backward (creating a loop).