Re: HP 33s Message #9 Posted by Ben Salinas on 22 Nov 2003, 7:47 p.m., in response to message #6 by CME750
In a purely theoretical sense, with 32kb of memory you could emulate more subroutines. It would be terribly inneficient in terms of memory, but with 32kb, who cares
Imagine this. We have routine A. At the begining of A there is one subroutine, which can be accessed by a GTO. After that subroutine is complete, it will have a RTN. After the RTN, there is a second, entirely different subroutine, which can be accessed by a XEQ (which doesnt stop at a RTN, I believe...). As long as the first subroutine does not mess with any of the variables for the second subroutine, then you would be fine
Of course it would be terribly inneficient, and incredibley complex to code.
I guess you could also have it do some simple subroutines separated by conditional tests, or if you say
Input Z
1
x=y?
a command
Would that leave the Z and 1 on the stack, or are they consumed.
A final theoretical method would be if you had subroutines which began the same, you could have it break if it reaches a specified number.
Say we would like to have subroutine A1 and A2. A1 and A2 start with the same 5 commands, but after those 5 commands, A1 should break, and A2 continue. Given a variable Z, you can set it to 1 if you want to run A1 and 2 if you want to run A2 (or a flag, or something of the like). After the five commands are ran, have a conditional test to check if Z=1, and if it does, have it RTN. After A1, are the commands for A2.
Just a few thoughts
-ben
|