Final Flashcards
Where is the first parameter on the stack held?
[EBP+8]
Where is the return @ held on the stack
[Ebp+4]
Where is saved ebp on the stack?
[ebp]
Where is the 1st local variable on the stack?
[ebp-4]
What needs to surround each sub program in a function?
Push ebp
Mov ebp,esp
…..
Pop ebp
Rey
Local variables on the stack are stored…
In order
Parameters in stack are stored in…
Reverse order
Pushing an element is…
Decrease ESP by 4
Popping an element is…
Increase by 4
When translating from C to Nasm, if there is a local variable, in addition to the code surrounding the sub program you must…
Sub esp (the amount of local variables)
….
Add ESP, (the amount of local variables)
Return @ main, saved ebp appears only after….
The parameters on the stack
After each function on the stack, the stack pushes…
Return @ main,
Saved ebp
The big picture of running code
(High level code) Compiler > (assembly code) assembler > (machine code) linker > machine code exec) loader > the program runs!
What does the compiler do?
Takes in source code and scans and parses the code to them generate machine code
The scanner identifies correct words using:
Regular expressions