I'm writing a program that stores all of it's variables and some other data starting at the low end (closer to address 0) of stack space and continuing for what I believe to be less than 1000 bytes. First, the initialization code checks the task structure to make sure the normal 4KB or more is there, then clears the desired space before using it. This was fine until I added a few more variables recently and started to experience crashes after the terminating rts instruction. I remedied this by tidying up/getting rid of the few variables the program no longer uses. But this program is far from done and soon enough, I'm going to need extra variables again.
I took this approach to variable storage thinking that all the stack space lower than the current stack pointer is up for grabs - can anyone set me straight?