![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2006
Posts: 14
Rep Power: 0
![]() |
Dereference Value on the Stack
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] |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Heap vs. Stack memory | Eric the Red | C++ | 11 | Oct 24th, 2006 6:18 PM |
| stack question | bl00dninja | C++ | 9 | May 8th, 2006 7:54 PM |
| stack query | aloksave | C | 12 | Sep 30th, 2005 4:26 PM |
| Smashing a stack in MIPS assembly code | tsgrimey | Assembly | 2 | Feb 27th, 2005 1:06 PM |
| Help with stack implementation | ridley | C++ | 0 | Feb 26th, 2005 2:26 AM |