Stack - Printable Version

+- Forum (
+-- Forum: Compilers and Computer Languages (
+--- Forum: ZX Basic Compiler (
+---- Forum: How-To & Tutorials (
+---- Thread: Stack (/showthread.php?tid=524)

Stack - na_th_an - 02-08-2013

Maybe this has been solved before, but I can't search for "stack" in the forum 'cause the search engine tells me it's a very common word so it won't be included in the search XD

Were the stack is located? Can I control where it is located without messing things up?

I'm asking this 'cause I'll be trying using extra RAM pages in 128K models for storage.

Re: Stack - boriel - 02-08-2013

Stack is leave untouched, so it's below the RAMTOP (it's set with the CLEAR command in the loader). Basically, it's below your ORG address. So setting ORG at 32767 for example, will enlarge your available stack (at expenses of shrinking the program memory).

Update: Stack is only used for function calls (parameters, return address, etc). So it's possible (with some caution) to change the SP register before calling a function, call it, and restore the SP register upon return, for example. I guess you could use a switched memory bank as a temporary stack. 8)