Howdy all,
I'm kind of new to assembly, and I'm using NASM 2.00. I've learned that you can dereference a value from an address stored in a register, or in memory, by enclosing the memory address in brackets, like this:
mov eax, [memory_location]
As far as I can tell, this is similar to using * to dereference a pointer in C.
I can't figure out how to do the same for an address pushed on the stack, from inside a procedure.
Example:
push memory_location
call my_procedure
my_procedure:
push ebp
mov ebp, esp
mov eax, [ebp + 8]
The last instruction will move the address stored at [ebp + 8] into the eax register. What I'd like to do is dereference the value stored at [ebp + 8], and store that in eax.
Can that be done in one instruction? Or do I have to do something like this:
mov eax, [ebp + 8]
mov edx, [eax]