According to the tech manual, you are allowed to
have the stack anywhere you like and upto 64K.
Does anyone know if you can have multiple stacks?
If so, how is this done?
According to which tech manual? Apple IIGS GS OS Internals describes it's interaction with the stack. There are memory locations to manage the stack and calls.
The 65816 has one 16-bit stack limited to bank 0. You could create smaller stacks within the overall 64K of stack space. You could even copy bank 0 to and from other banks if you needed to free up stack space or switch context, albeit slowly.
There are many ways to do this.
Apple IIGS/OS Reference Manual
I forgot about this section
Each program running on the Apple IlGS reserves a portion of bank $00 as a combined
direct-page/stack space. Because more than one application can be loaded in memory at
one time on the Apple IIGS, more than one stack and one direct page could be in bank $00
at a given time. Furthermore, some applications may place some of their code in bank
$00. A given program should therefore probably not use more than about 4 KB for its
You say you can have have smaller stacks that add up to 64K. Are you saying
just to write your program in smaller sections?
Okay, now I am reading the same manual as you. from page 38...
Note: There is no provision for extending or moving the direct-page/stack space after
its initial allocation. Because bank $00 is so heavily used, any additional space you
later request may be unavailable—the memory adjoining your stack is likely to be
occupied by a locked memory block. Make sure that the amount of space you specify
at link time fills all your program's needs.
It sounds like GSOS has some limitations, but nothing that probably could not be worked around if you need to. How large of stack does your program need? I was thinking in terms of programming the 65816 with GSOS out of the way, but I can think of some ways to get around this. It means managing your stack (or stacks) yourself -- like checking for overflow, swapping stack memory as needed and returning everything back to the way GSOS expects it on return.
I will say that I will go for the maximum (64K) and tailor it from there.