rainwarrior wrote:I edited it.
It's much better. But I think it sounds like the 2nd and 3rd paragraphs are contradicting the first a bit. Personally, I'd give the strict definition first, and then provide an example of the common case that is initializing S to $FF and using all 256 bytes at $0100-$01FF for the stack, and finally mention the other possible cases: stack smaller than 256 bytes and/or S initialized to values other than $FF (or left uninitialized). Something like this:
tokumaru wrote:
Strictly speaking, a stack overflow is when the program attempts to push more data than the stack can hold, and an underflow is when it attempts to pull data off the stack when it's empty. Under normal circumstances, that would mean pushing when S is already at $00 (overflow) or pulling when S is already $FF (underflow). Usually this implies a PHA vs. PLA mismatch of some sort.
However, since programmers can choose to use less than 256 bytes for the stack in order to free some of the RAM at $0100-$01FF for other uses, the boundaries of the stack won't necessarily always be at $FF and $00.
There's also the fact that S can be initialized to values other than $FF, or even be left uninitialized (since the stack pointer simply wraps around at the end of the range), and that that could also cause the boundaries to be at positions other than $FF and $00.
I prefer not to edit the wiki directly, since I'm not a native English speaker and that makes me a little insecure about the correctness and clarity of what I write.