Direct addressing uses a fixed address in the instruction. But what if the address isn’t known until runtime (e.g., pointers, dynamic memory)? We need a way to specify an address that can change.
Indirect Addressing specifies a register (or memory location) that holds the address of the operand. The CPU first reads the register to get the address, then accesses memory at that address.
- Instruction specifies a register (e.g., BX) that contains the address
- CPU reads the register to get the memory address
- CPU performs memory access using that address
- Example:
MOV AX, [BX]— BX holds address, CPU reads memory at (BX) and loads into AX - Requires two memory accesses: one for instruction, one for operand
- Address can be computed at runtime (pointers, dynamic allocation)
- Used for arrays, linked lists, pointers
- Slower than direct addressing (extra register read, still needs memory access)
- Foundation for more complex addressing modes (indexed, displacement)
- Built from: Addressing Mode, CPU Register
- Contrasts with: Direct Addressing — fixed address in instruction
- Builds into: Indexed Addressing, Register Indirect with Displacement
- Related: Pointer, Memory Address
- Register must contain valid address (null/invalid pointer causes exception)
- Two memory accesses: slower than direct addressing
- Register value can change at runtime (unlike direct addressing)