HP Forums
Entering (and losing) programs on HP 48 - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Entering (and losing) programs on HP 48 (/thread-16164.html)



Entering (and losing) programs on HP 48 - calculon - 01-12-2021 01:37 AM

After years of using HP calculators for simple tasks I've decided to take the plunge and learn how to program the HP 48, starting with the information in the HP 48 Owner's Manual. But I've hit a snag. One program from this book that I've definitely keyed in correctly can't be put on the stack because of an "Invalid Syntax" error. This means losing the work... or does it? I'd be very surprised if the calculator can't save a partially or wrongly entered program but I can't find anything in the Manual or online to enlighten me. (The program that I've now typed in and lost twice is BDISP on p. 31-10. The error comes at the very end, before PRESERVE that was previously entered successfully.)


RE: Entering (and losing) programs on HP 48 - Steve Simpkin - 01-12-2021 02:55 AM

(01-12-2021 01:37 AM)calculon Wrote:  After years of using HP calculators for simple tasks I've decided to take the plunge and learn how to program the HP 48, starting with the information in the HP 48 Owner's Manual. But I've hit a snag. One program from this book that I've definitely keyed in correctly can't be put on the stack because of an "Invalid Syntax" error. This means losing the work... or does it? I'd be very surprised if the calculator can't save a partially or wrongly entered program but I can't find anything in the Manual or online to enlighten me. (The program that I've now typed in and lost twice is BDISP on p. 31-10. The error comes at the very end, before PRESERVE that was previously entered successfully.)

Typically when you get an "Invalid Syntax" error when entering a program, it will leave the faulty program on the entry line with the offending syntax highlighted so you shouldn't lose the entry unless you press ON twice to delete it. If you can't find the error and you want to save the entry for later, put quotes around it and enter it as a string on the stack. You can leave it on the stack or save it as a string in a variable. Later when you want to edit it again, recall it to level 1 on the stack, press the down arrow to place it in the command line and remove the quote marks.


RE: Entering (and losing) programs on HP 48 - rprosperi - 01-12-2021 03:42 AM

A variation of what Steve is suggesting, for entering long, troublesome RPL programs is to enter a portion of the program (with appropriate closing levels of brackets) that is valid (even if not complete) and save that into some variable, e,g, 'TEMP1'. When you're ready to proceed to the next section, recall TEMP1 to the stack, add additional code, and then save it to a new variable 'TEMP2. If this latest addition isn't valid and you lose it, you can go back and get TEMP1 from storage and try again. If the latest section is saved without error, then proceed as above, but now starting with TEMP2, saving to TEMP3 after adding more code, etc. Following this procedure, you will only lose the code typed-in in the most recent section and have the TEMPn VARs available to pick-up where you left off, without losing the whole thing.


RE: Entering (and losing) programs on HP 48 - calculon - 01-12-2021 04:11 AM

Thanks for the suggestions. At least I'll have something to show for my efforts! It's odd that the calculator doesn't let you enter your entire program, warts and all, leaving error detection until the program is run. At least then you'd have the chance of single-stepping through it to find where the problem lies. As it is, I get an error message with the cursor on a delimiter (I've checked and double-checked to make sure they're all in order), which is no help at all.


RE: Entering (and losing) programs on HP 48 - SammysHP - 01-12-2021 06:00 AM

A program is not stored as a string, so if it can't be parsed, the calculator doesn't know how to store it.


RE: Entering (and losing) programs on HP 48 - Dave Britten - 01-12-2021 06:35 PM

When I'm writing RPL programs, I almost always start by storing an empty program (<< >>) into an appropriately named variable, then putting that name on the stack and invoking EDIT/VISIT. Then you'll get the full-screen editor, and pressing ENTER to save the program will check the syntax and store it directly back into the variable, rather than leaving it on the stack and vulnerable to some mishap.


RE: Entering (and losing) programs on HP 48 - calculon - 01-13-2021 04:32 AM

Thanks for another suggestion. I'll try this. I was put off in the past by the (to me) quirkiness of RPL with its sea of delimiters and odd layout but this time I'm determined to persevere.


RE: Entering (and losing) programs on HP 48 - MNH - 01-13-2021 10:38 AM

I suggest you program with USER active and assign the left-shift [EEX] (PURG) key with something benign. I can't tell you how many times I've purged a variable containing a program by inadvertently hitting the left-shift [EEX] (PURG) key, which is uncomfortably close to the left-shift [+/-] ( EDIT) key. Best of luck with your programming!


RE: Entering (and losing) programs on HP 48 - C.Ret - 01-13-2021 11:38 AM

Reading all troubles have calculon entering his first RPL codes and all the tricks you all RPLers have to used on your systems, I realize how lucky I was learning RPL on the HP-28S !

Full alphabetic keyboard, clear cursor modes, one unique shift key, and alerting `bips` were on this old RPL of great help and allowed comfortable inputs despite the relatively small display size !


RE: Entering (and losing) programs on HP 48 - Dave Britten - 01-13-2021 12:34 PM

(01-13-2021 10:38 AM)MNH Wrote:  I suggest you program with USER active and assign the left-shift [EEX] (PURG) key with something benign. I can't tell you how many times I've purged a variable containing a program by inadvertently hitting the left-shift [EEX] (PURG) key, which is uncomfortably close to the left-shift [+/-] ( EDIT) key. Best of luck with your programming!

If you have last stack enabled, you can recall a purged object to the stack if you immediately press ARG after purging.


RE: Entering (and losing) programs on HP 48 - MNH - 01-16-2021 01:37 PM

(01-13-2021 12:34 PM)Dave Britten Wrote:  If you have last stack enabled, you can recall a purged object to the stack if you immediately press ARG after purging.

Is last stack enabled by a system flag?


RE: Entering (and losing) programs on HP 48 - Dave Britten - 01-16-2021 01:59 PM

(01-16-2021 01:37 PM)MNH Wrote:  
(01-13-2021 12:34 PM)Dave Britten Wrote:  If you have last stack enabled, you can recall a purged object to the stack if you immediately press ARG after purging.

Is last stack enabled by a system flag?

Yeah, flag -55 enables Last Arg according to the manual. It doesn't say which flags enable Last Stack (Undo) and Last Command, which is weird. They should be somewhere in the Mode menu, though; I generally just leave them all on.


RE: Entering (and losing) programs on HP 48 - John Keith - 01-16-2021 06:43 PM

(01-16-2021 01:59 PM)Dave Britten Wrote:  It doesn't say which flags enable Last Stack (Undo) and Last Command, which is weird. They should be somewhere in the Mode menu, though; I generally just leave them all on.

I've often wondered that myself. Is it possible that those modes are not part of the system flags at all?


RE: Entering (and losing) programs on HP 48 - Joe Horn - 01-16-2021 07:18 PM

(01-16-2021 06:43 PM)John Keith Wrote:  
(01-16-2021 01:59 PM)Dave Britten Wrote:  It doesn't say which flags enable Last Stack (Undo) and Last Command, which is weird. They should be somewhere in the Mode menu, though; I generally just leave them all on.

I've often wondered that myself. Is it possible that those modes are not part of the system flags at all?

Last Stack (UNDO) and Last Command are not controlled by any of the User RPL "system flags", so you can't turn them on or off using SF and CF. All things are possible, however, to System RPL programmers (e.g. UNDO_OFF in System RPL disables UNDO).