• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

The Problem

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?

Core Idea

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.

How It Works

  1. Instruction specifies a register (base) and a constant offset (displacement)
  2. CPU reads the register to get base address
  3. Effective address = register value + displacement
  4. CPU accesses memory at computed address
  5. Example: MOV AX, [BX + 4] — accesses memory at (BX + 4)
displacement Instr Instruction (MOV AX, [BX+4]) Base Reg: BX | Disp: 4 Add Effective Address 2000h + 4 = 2004h Instr->Add BX Register BX base: 2000h BX->Add Mem Memory Addr 2004h: data Add->Mem CPU CPU AX ← data Mem->CPU

Key Properties

  • 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

Connections

Edge Cases & Gotchas

  • 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)