mov ,eax <--- allocates 4 bytes onto the stack and stores the value of eax there?
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:
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...
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...
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
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
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