LEA instruction

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
pepito

LEA instruction

Post by pepito »

When I use the LEA instruction into a NASM code running in protected mode,
LEA calculate the offset about where?

(Sorry my poor english)  

pepito
Ramanan

RE:LEA instruction

Post by Ramanan »

it returns the offset value from the selector starting point.
It does nothing more than copying the value from the register.

...
YogaRamanan.T
Dangamoose

RE:LEA instruction

Post by Dangamoose »

lea finds the offset from the base of your segment for the current variable used within the instruction.
i.e.
if i have a base of zero, beginning of ram and do...
lea eax, [somevariable]
eax will contain the offset from the segment base (zero), i.e. the location of the somevariable variable and place it in eax.

You could always look inside the intel manual 2, it goes pretty far when instructions are concearned, and the assembler doesn't make any difference. Instructions are instructions, they all do the same.

Dangamoose
pepito

RE:LEA instruction

Post by pepito »

Thank you very much!
Post Reply