mov ,eax <--- allocates 4 bytes onto the stack and stores the value of eax there?
Posted on 2011-04-17 08:29:52 by dougfunny
You're half correct.  That will store the contents of eax to where esp is currently pointing.  However, to "allocate" stack space you need to:


sub esp, 4


to store 32-bit quantities.  There are, of course, additional factors that come into play when taking into consideration function calling sequences, multiple stack variable space, push/pop, etc...
Posted on 2011-04-17 09:18:50 by p1ranha
ok understood. i have 2 more things tho

Say esp = top of stack currently...will this allocate 4 bytes of storage and then store value of eax?
mov , eax
Say esp = top of stack currently...will this allocate 4 bytes of storage and then store value of eax?
push , eax
only difference between these 2 is the push and mov
Posted on 2011-04-17 11:06:55 by dougfunny

Say esp = top of stack currently...will this allocate 4 bytes of storage and then store value of eax?
mov , eax


No.  The only difference between this line of code and your first post is the subtraction of 4.  This does not allocate stack space.  It only changes where you want the contents of the eax register to be stored.  Allocating stack space for variables can only be done with sub esp, ###


Say esp = top of stack currently...will this allocate 4 bytes of storage and then store value of eax?
push , eax


No, that line should not even assemble as the operands to the push instruction are invalid.

Go to Intel's website and read chapter 6.2 which specifically outlines stack related topics: http://www.intel.com/Assets/PDF/manual/253665.pdf
Posted on 2011-04-18 06:16:39 by p1ranha