Post Reply 
Little explorations with HP calculators (no Prime)
03-22-2018, 11:32 AM (This post was last modified: 03-22-2018 11:34 AM by 3298.)
Post: #290
RE: Little explorations with HP calculators (no Prime)
(03-22-2018 02:16 AM)brickviking Wrote:  
(03-21-2018 10:45 AM)3298 Wrote:  The 9860 series also adds a list label (basically a string) as List n[0], but I can't remember if that existed before OS 2.0 or only after.

It's on my gII but not on my g+. I'm pretty sure it's mentioned in the manual for all gII versions, including the 9750.
Yes, because the 9750GII is part of the 9860 series, as I've written before, and the 9750G+ is part of the old CFX series instead. Also, all GII models already come with OS versions >= 2.0.

(03-22-2018 02:16 AM)brickviking Wrote:  You could do it this way, -snip-
Nice idea, but if I recall correctly, there may be some problems with contents getting zeroed while resizing. (i'm not 100% sure as I last used a Casio many years ago, but I feel like there was something.) You might get around that using matrices which have a special command designed for augmenting without destroying the contents (aptly called "Augment"), but all this is a hell of a lot of work for something as essential as local variables.
Also, older calculators have some further limitations to work around: assigning dimensions directly errors on non-plus CFX calculators (... okay, those are ancient), but I'd expect at least Augment and the List->Mat, Mat->List combination to be usable as a workaround; trying to read a list element that doesn't exist (e.g. your size slot when the list is still empty) results in an error too, and writing past the end of the list to grow it is only supported on new calculators (I don't know if the AFX likes that, but the CFX clearly doesn't). Some of the RPL gurus might think that's not a big deal since they are accustomed to IFERR and friends, but errors cannot be caught on the Casios.

(03-22-2018 02:16 AM)brickviking Wrote:  I can then restore that many variables. Yes, there are weaknesses in this, I haven't fully got my head around the aspects of shutting down programs in mid-stream without cleaning up the stack list.
Right, since errors (including the interruption caused by pressing AC/ON) cannot be caught they may pose a little problem. Shouldn't be a huge deal though, since unless the error happens in the middle of this stack push/pop code the effect should be limited to just leaking memory like a C program that forgot to free a malloc'ed block. I'd consider it less of a problem than trying to convince other programmers to use that system over their own less sophisticated variable backup systems.

One limitation that hasn't been mentioned yet in this context is speed. Several of the missing features can be worked around, but the code to do so is very slow (and it fills the memory, which isn't exactly in ample supply either, since the AFX at 140KB is their only calculator with more than 64KB main memory).
I once wrote something resembling text input/output on the 9750G+. As a member of the CFX series it doesn't have strings, so I produced some giant If-Then-Else chains to translate keycodes+shiftplanes into some custom character encoding, as well as to output the corresponding character onto the screen. It was horribly slow, filling the screen with stored text took like a minute, and typing a single character took at least 1.5 seconds. The program also occupied more than half the memory of this calculator. Compare that to the HP48 series where you can simply take strings from the stack as input or leave them there as output at basically no cost. Or use something like PROMPT or INPUT if you insist on interacting with the user in the middle of the program.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Little explorations with HP calculators (no Prime) - 3298 - 03-22-2018 11:32 AM



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