code snippet:

LOCAL x : dword

mov eax, addr x

What code does masm generate to get the address of the x variable?
Posted on 2003-04-18 08:47:17 by Odyssey
It is a local so it is ebp or esp based... MASM uses ebp, IIRC...
But why not take a debugger/disassembler and test it on your own program ?
Posted on 2003-04-18 08:54:13 by JCP
"mov eax, addr something" won't assembly since you can't load the address of a local with 'mov'. Addr only works for invoke. You can use lea eax, local though.

Thomas
Posted on 2003-04-18 09:07:39 by Thomas
Not a 100% but in most dissassemblys (bug searching) i have done with my work, the invoke/addr's turn into "LEA eax, " followed by a "PUSH eax".

:NaN:
Posted on 2003-04-18 09:14:47 by NaN
i suppose



myproc proc
LOCAL test1:DWORD
lea eax,test1
ret
myproc endp


would be converted to



004010C3 /. 55 PUSH EBP
004010C4 |. 8BEC MOV EBP,ESP
004010C6 |. 83C4 FC ADD ESP,-4
004010C9 |. 8D45 FC LEA EAX,DWORD PTR SS:[EBP-4]
004010CC |. C9 LEAVE
004010CD \. C3 RETN
Posted on 2003-04-18 09:30:56 by roticv
Thanks everyone. I have an idea what's goin on now.
Posted on 2003-04-18 09:35:28 by Odyssey