x86 Assembly Language Reference Manual

Addressing Modes

Addressing modes are represented by the following:

[sreg:][offset][([base][,index][,scale])]

Following are some examples of addresses:


movl var, %eax

Move the contents of memory location var into %eax.


movl %cs:var, %eax

Move the contents of the memory location var in the code segment into %eax.


movl $var, %eax

Move the address of var into %eax.


movl array_base(%esi), %eax

Add the address of memory location array_base to the contents of %esi to get an address in memory. Move the contents of this address into %eax.


movl (%ebx, %esi, 4), %eax

Multiply the contents of %esi by 4 and add this to the contents of %ebx to produce a memory reference. Move the contents of this memory location into %eax.


movl struct_base(%ebx, %esi, 4), %eax

Multiply the contents of %esi by 4, add this to the contents of %ebx, and add this to the address of struct_base to produce an address. Move the contents of this address into %eax.