Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
How to deal with a local variable.
I am trying to make a program that translate a c code to the assembly code
like complier. But i stacked when i deal with local variable.
what i want to do is,
1, save esp to a variable which is declared in data segment
2, push a variable into stack.
3, access the stack to find out the variable
The problem is this program uses the stack all the time. So, esp is
changing all the time. Even though i saved the pointer of the variable,
i still cannot access the variable in the stack.
Because, We can't access the memory space like.
mov eax, dword ptr [mem + di]
;mem is a variable that declared in data segment
;mem has the value of esp
Is there any easy way to access the data in specific place of stack.
Without waring about the esp.
Sorry for my break English, I am not sure, have i explained clearly.
Feel free to ask me, if you didn't understand my question.
Thank you all & have a good night.