Slide 8.5: SIZEOF operator and LABEL directive
Slide 8.7: Memory addressing
Home

Addressing Modes


An operand address provides a source of data for an instruction to process. The three basic modes of addressing are
Register Addressing
Because processing data between registers involves no reference to memory, it is the fastest type of operation.

Immediate Addressing
An immediate operand contains a constant value or an expression. The use of an immediate operand provides faster processing than defining a numeric constant in the data segment and referencing it in an operand.
 Register Addressing  Direct-Offset Operand  Immediate Addressing
 .code
     mov   eax, 0
     mov   ebx, 1
     mov   ecx, 7
 L1: add   eax, ebx
     call  WriteInt
     xchg  eax, ebx
     loop  L1
 .data
 X  SWORD  1234h
 Y  SWORD  5678h
 .code
 movsx  eax, Y+1-2
 call   WriteHex
 .data
 X  SWORD  1234h
 Y  SWORD  5678h
 .code
 add    Y, 1-2
 movsx  eax, Y
 call   WriteHex
 Output  Output  Output