well... once you have LEA'ed, you access directly.
Assuming var1 = 00FFh, the following code would give you EAX = 00FFh
lea eax,
mov eax,
and so would
mov eax,

(notice that the LEA approach is required if you need to pass the OFFSET of your variable to some routine).

Now, the interesting thing - this isn't "raw" assembly if your values are on the stack (local memory). You would be doing...

lea eax,
lea eax,

esp is the "direct" way, since esp is the stack. However, this can be cumbersome if you're doing push/pop inside your routine, as the "- XX" offset will not be static for a given local variable. Thus, compilers and highlevel assemblers usually set up a "stack frame", by

push ebp
mov ebp, esp

then, you can push/pop all you want, and alway access local variables (or function paramaters) as ebp-xx (local) or ebp+xx (parm).

That's a lot to digest, I think? :)
Posted on 2003-04-24 17:26:48 by f0dder
Ok, I'm off for bed, somebody else will have to take over for now :)
Posted on 2003-04-24 17:27:06 by f0dder
hehe ok!

Thank for your help f0dder!

I'll not post more messages for today too!!
I think I'll read some tutorials here in my pc, then the next time, I will arrive with more intelligent questions to you... :-)

Posted on 2003-04-24 17:32:50 by FERNANDO-BRASIL
Oi Fernando,

Bem-vindo! O pessoal do board ? muito legal e realmente entendem de assembly
(exceto eu que estou em um n?vel um pouco inferior ao seu... hehe). Seria interessante voc? ler os tutoriais de Iczelion (h? vers?es em ingl?s e espanhol), ou ainda ver esse link:


Este site cont?m um tutorial b?sico excelente (segue mais ou menos os tutes de Iczelion por?m em portugu?s).

Uma coisa muito importante: ? ACONSELHAVEL pesquisar antes de perguntar (bot?ozinho "search")... :-)

Posted on 2003-04-24 18:04:29 by xyzero
Take a look at what MASM generates when you use INVOKE - .IF - .ELSE - etc. Chances are you would do pretty much the SAME THING in "real Assembler". The idea of using these "hi level" verbs is to make things easier! It makes it easier to write, and more imporatantly, it makes it easier to READ and follow!!! There are exceptions, but in general, MASM does a pretty good job when it comes to generating the "best" code. And remember, INVOKE is just as much a part of assembly programming these days as CALL is. Plus, as mentioned, INVOKE does some good stuff for you, like make sure you're passing the correct number of parameters, etc.

To do this, take Mirno's advice, and create the /Fl file. But you also need to add the /Sg switch to the ML command line, or use the .LISTALL directive in your program.

Posted on 2003-04-24 22:23:05 by S/390
mov eax, = mov eax, DWORD PTR
mov ax, = mov ax,WORD PTR
mov al, = mov al,BYTE PTR

Hope this clears your mind and your problems :)

Haha... fodder the part on esp and ebp would probably be confusing for him. He seemed to mistook esi for esp. In all stdcall, the stack is balanced in the function, but for c calling conventions, the stack must be balanced by the caller. No need to worry much about it as MASM do it automatically for you (unless you off that option to create stack frame).
Posted on 2003-04-25 02:30:10 by roticv
yes roticv, it was somewhat of a big mouthful - he did, however, want to know how stuff works "behind the scenes", so... no escaping the stack/frame pointers :)
Posted on 2003-04-25 02:34:15 by f0dder