Structured data (structs, records) have fields at fixed offsets from a base pointer. Accessing object.field requires base address + field offset. Can addressing mode handle this?
Register Indirect with Displacement computes the effective address by adding a register value (base) and a constant displacement (offset). Ideal for accessing structure fields and stack variables.
- Instruction specifies a register (base) and a constant offset (displacement)
- CPU reads the register to get base address
- Effective address = register value + displacement
- CPU accesses memory at computed address
- Example:
MOV AX, [BX + 4]— accesses memory at (BX + 4)
- Perfect for struct/record field access: base = struct pointer, displacement = field offset
- Displacement is fixed at compile time (field offsets don’t change)
- Used for stack variables (SP/BP + offset), struct fields, array elements
- More flexible than pure indirect or indexed addressing
- Built from: Addressing Mode, Indirect Addressing
- Related: Struct, Stack, Effective Address
- Contrasts with: Indexed Addressing — uses register for index, not constant
- Builds into: Stack Frame — accessing local variables
- Displacement is limited (typically 8 or 16 bits in instruction encoding)
- Register must contain valid base address
- Common in RISC:
lw $t0, 4($sp)(MIPS load with displacement)