http://www.hobbyprojects.com/microprocessor_systems/images/stack.gif
The stack is a temporary data store.
The CPU can push important data onto the stack while it is processing other data.
When it completes this task, it removes the stored data from the stack.
It's like a bunch of plates. The bottom plate is the first bit of data that has been pushed onto the stack. The top plate is the last data to press. The top plate extends first, and the bottom plate is the last data to be pulled out. This is the LAST IN, FIRST OUT stack.
In diagrams X, it will be pressed first, then Y, and finally A. The CPU leaves to process other data. Upon completion of this task, it returns to pull out the stored data. First, A stretches, then Y, and finally X.
Data entry instructions are PHAs. Only data in the battery can be pushed onto the stack. Other data may be pressed if it is first transferred to the battery.
Instructions for retrieving data from the stack - PLA. Stack data is transferred to the drive.
Stack 6502 consists of 256 bytes and occupies page 1, addresses from 256 to 511.
Chris
source share