Sunday, June 26, 2011

Assembly language angle brackets

The [ebx] in mov eax, [ebx] means that [ebx] is a pointer, kinda like ebx*.
So that line of assembly means move whatever is in the address written in ebx into eax.

... EXCEPT FOR lea

As explained from this assembly guide.
lea — Load effective address
The lea instruction places the address specified by its second operand into the register specified by its first operand. Note, the contents of the memory location are not loaded, only the effective address is computed and placed into the register. This is useful for obtaining a pointer into a memory region.
Syntax
lea <reg32>,<mem>
Examples
lea eax, [var] — the address of var is placed in EAX.
lea edi, [ebx+4*esi] — the quantity EBX+4*ESI is placed in EDI. 

No comments:

Post a Comment