by vcbdcgdg · 7y ago · 0 comments
I have a stopwatch function in my HP48 that I don't want using a local variable (avoid polluting my precious menu), or having to keep it in a stack.
Instead I want the value of the last time I ran the program to be stored within the program itself. I believe this is called a closure in CS.
Right now I can have << value -> X 'expression' EVAL rest of the program >>
And it'll work just fine, but how could I get the value at the very top modified?
(I know my cell phone has a stopwatch. We're not allowed phones at work)
Not at all.
> I have a stopwatch function in my HP48 that I don't want using a local variable (avoid polluting my precious menu), or having to keep it in a stack.
The first thing that comes to mind is that there's a hidden directory at the root that the ROM itself uses to store stuff like this. This link talks a bit about how to get there:
https://www.hpmuseum.org/forum/thread-12986.html
This uses SYSEVAL to call into a normally-not-visible object that puts the name of the directory on the stack. From there, you should be able to read/write the variable.
You may also be able to do some hacky stuff with self-modifying code, but that's honestly something I'd avoid unless you want to try it for fun.