© Thomas Kunz 2000
SCE 574
97
Stacks for Subroutine Support
äStack
äUsed to support assembly level subroutine calls
äHelps store values temporarily and recall them later
äContiguous region of memory pointed to by the stack pointer SP register
äIf used, must initialize its initial memory
ässeg  segment stack ‘data’
ädw 80h dup(?)
ässeg ends
äTwo operations: PUSH and POP
äPUSH
äInserts a new data value at the top of the stack
ä(1) Decrements the SP by 2
ä(2) Save the data value in memory location addressed by SP
äPOP
äReturns valued of data at top of stack and removes it from the stack
ä(1) return value from memory addressed by SP
ä(2) increment the stack pointer SP by 2
Stack Bottom
Stack Top
Initial SP
Always
push
words
not
bytes