flat assembler
Message board for the users of flat assembler.
Index
> Main > LEA confusing me |
Author |
|
edfed 31 May 2011, 19:52
i think the reason you think that is because you still not pointed that lea means load, and not move.
every load instructions in x86 uses a pointer to an adress as an operand. for example, lgdt loads the content of gdtr pseudo descriptor in a ram location. Code: lgdt [ebx+eax*8+sys.gdt] for example, will use the conventionnal adress formula as an operand, there are lea, lgdt, lidt, lldt, ltr, lsl, etc... all these instructions uses a memory operand. and lea is just the Load Effective Adress, means exactlly what it does, it loads the effective adress using the 32 bits adress operand. Code: [segment : offset + pointer + index * scale ] : effective adress the segment part is not included in the result of the adress calculation because the result will be relative to a segment. |
|||
31 May 2011, 19:52 |
|
ouadji 31 May 2011, 21:20
most often, I use "lea" to compute a "result", and not to compute an address. Code: lea ebx,[(ecx*2) - 6] mul ebx and much more powerful than it appears at the first glance. |
|||
31 May 2011, 21:20 |
|
Teehee 31 May 2011, 22:12
now it makes more sense
thanks |
|||
31 May 2011, 22:12 |
|
MazeGen 01 Jun 2011, 14:04
LEA is one of those weird instructions in x86 ISA. It uses source operand that has nothing to do with memory, it is just encoded as a memory operand.
|
|||
01 Jun 2011, 14:04 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.