previous | start | next

The IA32 movl and addl instructions

If an operand is in memory, an instruction might want to know just the location (i.e., in order to store some value there).

 movl %eax, -4(%ebp)  ; move contents of %eax to memory location -4(%ebp)


   

If the first operand of movl is a memory location, it also moves the contents to the destination register.

 movl -4(%ebp), %eax


   

An add instruction would need to know both the values stored at the locations of its operands and the location of the second operand:

 ; add contents of memory -4(%ebp)  and the contents of  register %eax
 ; store the result as the new contents of the memory location -4(%ebp).      

 addl %eax, -4(%ebp)  


   

Note: In both cases these instructions need the contents of the operands!



previous | start | next