Arrays and tables store data sequentially. Accessing array[i] requires computing address = base + i. Can the CPU compute this automatically during addressing?
Indexed Addressing computes the effective address by adding a base address (from instruction) and an index value (from a register). Perfect for accessing array elements and table lookups.
- Instruction specifies base address (e.g., 1000h) and index register (e.g., SI)
- CPU reads index register to get offset value
- Effective address = base address + index
- CPU accesses memory at the computed address
- Example:
MOV AX, [1000h + SI]— SI is index, accesses memory at (1000h + SI)
- Ideal for array access: base = array start, index = element offset
- Index register can be incremented in loops (efficient array traversal)
- Requires address computation (slightly slower than simpler modes)
- Used in loops, array processing, table lookups
- Built from: Addressing Mode, Indirect Addressing
- Related: Array, Loop, Effective Address
- Builds into: Register Indirect with Displacement
- Contrasts with: Direct Addressing — no index computation
- Index register must be set correctly before use (common bug: forgetting to increment)
- Address calculation may overflow (base + index exceeds address space)
- Requires more hardware (adder for address calculation)