I was reading The Art of Assembly Language (Randall Hyde, link to Amazon) and I tried out a console application in that book. It was a program that created a new co
This is the setup for the stack frame (activation record) for the function. Internally it normally looks something like this:
push( ebp ); // Save a copy of the old EBP value
mov( esp, ebp ); // Get ptr to base of activation record into EBP
sub( NumVars, esp ); // Allocate storage for local variables.
Then when the stack frame is to be destroyed again, you have to do something along the following lines:
mov( ebp, esp ); // Deallocate locals and clean up stack.
pop( ebp ); // Restore pointer to caller's activation record.
ret(); // Return to the caller.
Here is a better explanation of it using HLA. Though it is well explained in the book you're reading, as I have that book too, and I've read the section explaining it.