The trouble comes from the fact that we have two different arbitrarily-sized things (the drawing buffer and the stack) using the same page of RAM. There is a potential for conflict if they cross.
The 6502 uses the $0100-$01FF range of RAM for the stack. The bottom of the stack is $01FF and when values are "pushed" onto the stack, they are placed in memory in descending memory addresses. So for example, say we have an empty stack and we push some values to it like this:
lda #$01
pha
lda #$02
pha
lda #$03
pha
After this code is executed the stack in memory would look like this:
$01FD: #03
$01FE: #02
$01FF: #01
The first value is pushed into $01FF, then the next value into $01FE, and so on in reverse order. That's what I meant by "counting backwards".
You can push values onto the stack manually with PHA, but the 6502 also pushes things onto the stack automatically behind the scenes. For example, every time you call a subroutine with JSR, the 6502 will push a 2-byte return address onto the stack. This allows the program to know where to return to when it encounters an RTS command.
So there is a danger anytime you choose to use the $0100 page of RAM to store game-related variables. If you accidentally overwrite a memory location that is currently in use by the stack, things can go terribly wrong. Look at the following code, assuming an empty stack:
jsr my_subroutine
; blah blah blah
my_subroutine:
lda #$00
sta $01FF
rts
Here we call a subroutine with JSR, which pushes a 2-byte address onto the stack at $01FF and $01FE. Then in the subroutine we change the value of $01FF. When the program hits the RTS, it will pop the 2-byte return address off of the stack, but that address will be the wrong address (because we foolishly changed it!).
In practice, the stack usually doesn't grow very deep. Anything pushed onto the stack is usually popped off soon after. I've never seen the stack come even close to using all 256 bytes of the $0100 page. Since memory is tight on the NES, it's quite common for programmers to use the "front" half of the $0100 page for game variables (like a drawing buffer) rather than seeing that RAM go to waste.
Hope that clears it up. Let me know if you have any questions or need more clarification.s
]]>