Stack, Subroutine & Related Instructions
Stack, Subroutine & Related Instructions The Stack The stack is an area of memory identified by the programmer for temporary storage of information. The stack is a LIFO ( Last In First Out ) structure. The stack normally grows backwards into memory. – In other words, the programmer defines the bottom of the stack and the stack grows up into reducing address range. Given that the stack grows backwards into memory, it is customary to place the bottom of the stack at the end of memory to keep it as far away from user programs as possible. In the 8085, the stack is defined by setting the SP (Stack Pointer) register. LXI SP, FFFFH This sets the Stack Pointer to location FFFFH (end of memory for the 8085). The Size of the stack is limited only by the available memory Saving Information on the Stack Information is saved on the stack by PUSHing it on. It is retrieved from the stack by POPing it off. ...