whats the diference and how to use lea useful?
and what is better:
mov eax,offset buffer
or
lea eax,buffer

ps: i never used it in my programs because i dont know what it really do?
Posted on 2003-11-20 12:47:55 by zabnik
For addresses lea reg32,Var is used to move the address of a local or stack based variable into the register, mov reg32,OFFSET Var is used to move the address of a static variable into the register. Use mov where you can, lea only if necesary.
Posted on 2003-11-20 12:54:49 by donkey
zabnik,

As Donkey has said, you use LEA for data that is a LOCAL variable. It works like this in a proc,


LOCAL var:DWORD
........
lea eax, var
........

When you allocate a LOCAL variable in a proc, it is created at runtime on the stack so it does not have an OFFSET like data stored in the .DATA section which is known at assembly time. Depending on how many LOCAL values are allocated in the procedure, a LOCAL is something like,


[ebp-64]

which is the stack address in a register with a minus displacement. When the procedure is finished, the data in the local variable is lost as the stack is reused by the next procedure.

Regards,
http://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=2f46ed9f24413347f14439b64bdc03fd
Posted on 2003-11-20 18:21:28 by hutch--
lea is useful if you want to do some maths operations
lea eax, == eax *=5

You can use it to access item in a matrix
Posted on 2003-11-21 03:17:45 by greenant
thank you very much
---
did any1 saw my attachent?
Posted on 2003-11-21 10:49:52 by zabnik
6 ppl downloaded your file as for now i dont think they have done that just to make you happy :cool:
Posted on 2003-11-21 11:26:53 by AceEmbler