Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

asm Stack

Name: Anonymous 2012-01-18 9:13

So I was looking at examples of recursion in asm and how to use the stack and everything I saw would push the stack by subtracting the number of bytes it wanted at the beginning and then add them back at the very end.


Why is it that you have to subtract? Why not add and then subtract at the end?

Name: Anonymous 2012-01-18 10:13

>>1
Because the designers of the 8080, 8086, MIPS and other systems that have a downward-growing stack wanted you to put the stack at the top of memory so you could have the program and static data at the bottom, the heap in the middle, and the stack at the top. However, some computers do push by adding and pop by subtracting.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List