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

The Comparison

Different addressing modes exist to efficiently access data in different scenarios: constants, registers, fixed memory locations, arrays, structs, and control flow.

Side-by-Side Comparison

ModeOperand LocationExampleSpeedUse Case
ImmediateIn instruction (constant)MOV AX, 5Fastest (no mem access)Constants, initialization
RegisterCPU registerMOV AX, BXFastest (no mem access)Temp values, frequent access
DirectFixed memory addressMOV AX, [1234h]Fast (1 mem access)Global variables
IndirectAddress in registerMOV AX, [BX]Medium (2 mem accesses)Pointers, dynamic data
IndexedBase + index registerMOV AX, [1000h+SI]Medium (calc + mem)Arrays, tables
Register+DispRegister + constantMOV AX, [BX+4]Medium (calc + mem)Struct fields, stack vars
RelativePC + offsetJMP 10Medium (calc + mem)Branches, jumps
StackTop of stackPUSH AX, POP BXFast (SP is register)Function calls, expressions

Key Insights

  1. Fastest modes: Immediate and Register addressing (no memory access beyond instruction fetch).

  2. Most flexible: Indirect, Indexed, and Register+Displacement enable dynamic data access (arrays, structs, pointers).

  3. Control flow: Relative addressing is essential for position-independent code (branches, function calls).

  4. Stack addressing: Implicit addressing (no address in instruction) — used for function calls, local variables, expression evaluation.

  5. Trade-off: More complex addressing = more hardware (address calculation logic) but more flexible programs.

Connections