Memory Addressing


There are total eight addressing modes. Six of the modes are memory addressing: Direct Memory Addressing
In most instructions, one of the operands references a memory location and the other operand references a register.

The only instructions that allow both operands to address memory directly are Direct-Offset Addressing
This addressing mode, a variation of direct addressing, uses arithmetic operators to modify an address.

 mov eax, X+2  mov eax, X[2]  mov eax, [X+2]
 .data
 X  DWORD  12345678h
 .code
 mov   eax, 0
 mov   eax, X+2
 call  WriteHex
 .data
 X  DWORD  12345678h
 .code
 mov   eax, 0
 mov   eax, X[2]
 call  WriteHex
 .data
 X  DWORD  12345678h
 .code
 mov   eax, 0
 mov   eax, [X+2]
 call  WriteHex
 Output  Output  Output