Hello Watts,
There are 4 stacks in iziBasic:
1. a Jump Stack: if this is the one in overflow, then you better check all your GOSUB/GOTO/RETURN...
2. a Number Stack and a Text Stack for constants, variables and arrays. If one of these 2 is in overflow, then the only workaround is to extend the MINOSVERSION compiling directive, but with limited compatibility with older devices as a counterpart.
3. a Code Stack. Then, there are 2 ways to extend it:
3a. either the MINOSVERSION use (Code Stack may then evolve from 4000 up to 24000 bytes size);
3b. or use the CHAIN statement.
I guess that you are talking about a "Code Stack Overflow" since you also talk about the CHAIN command
There are 2 sample programs shipped with iziBasic that show you how to deal with CHAINed segments of codes: Numerus (3 segments of codes CHAINed) and iBAddress (2 segments of codes CHAINed).
As Numerus and iBAddress are both provided in 2 versions (1 full file or 2/3 CHAINed segments files), you will easily understand the little differences to apply to your current source code by comparing their versions of source codes.
The main trick to know is that when using CHAIN, the execution pointer always move to the BEGIN statement of the new segment. Then, the idea is to set some variable before CHAINing to tell the CHAINed segment what to do.
Cheers,
aldweb