let me know if i understand this correctly, but when you use the term stack you are only referring to the locations $0080 - $00FF? the stack is only 128 bytes, correct?
is a "pile of information". When you put something on the stack, it goes on top. When you take something from the stack, you take it off the top. You can think of it like a spring loaded cafeteria tray dispenser.
The stack resides on page 1 on the 6502 family of CPUs (of which the Atari's 6507 is a member). Page 1 means $0100-$01ff. The first 2 digits (01) of a 16 bit hex value define the page, so $0080-$00ff is on page 0. That's also known as zero page
because the 6502 CPUs can use it in special ways that are significantly
faster than using memory in other pages.
The Atari only has 128 bytes and is normally referenced at locations $0080-$00ff (because of the fast zero page access). The memory in the Atari is wired in such a way that it has "mirrors". Mirrors are when the same memory shows up at multiple address ranges. Besides zero page, the Atari's memory also shows up at $0180-$01ff.
When stack operations (PHA, PLA, JSR, RTS, etc) are performed, they are done using the page 1 addresses because that's how the CPU is designed. Since it's a mirror, the stack data is also visible on page 0. The memory isn't typically mirrored like this on other 6502 based systems, so this is unique to the Atari.
Since the same 128 bytes are used for zero page and the stack, you need to be careful to not have them trample on each other. The "bottom" of the stack is at $01ff so normal memory usage is normally assigned starting at $0080. Most 2600 games make very limited use of the stack due to how little memory there is.
Edited by SpiceWare, Thu Aug 8, 2013 10:22 AM.