Post Reply 
Free42 with big stack, test version
02-07-2021, 10:34 PM
Post: #63
RE: Free42 with big stack, test version
That seems pretty similar to the behavior of LNSTK and L4STK, except the implementation is totally different. I'm only using one stack and extending or truncating it as needed. L4STK saves levels 5..N to a hidden local variable, and when used in conjunction with FUNC, it also saves the levels that will end up in the four-level stack but are not used as input parameters. So if you have a function with FUNC 21, i.e. two inputs and one output, L4STK will save levels 3..N.

The question of when to do the automatic switch is a bit difficult. In terms of implementation, it seems like there's only one way to do it: when execution starts, perform L4STK or LNSTK, as needed, and if execution ends with a RTN while the RTN stack is empty, then the normal L4STK/LNSTK cleanup mechanism will do the right thing. But if a program ends with STOP, i.e. without returning from the top-level routine, then the automatic L4STK or LNSTK cleanup will not happen right away, because the calculator has no way of knowing whether the program is just stopped for input or really done. The L4STK or LNSTK cleanup could still be done when the user performs an action that clears the RTN stack, like GTO or XEQ, but that might come as a bit of a surprise when it finally happens.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Free42 with big stack, test version - Thomas Okken - 02-07-2021 10:34 PM



User(s) browsing this thread: 1 Guest(s)