Post Reply 
Entering (and losing) programs on HP 48
01-12-2021, 01:37 AM
Post: #1
Entering (and losing) programs on HP 48
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.)
Find all posts by this user
Quote this message in a reply
01-12-2021, 02:55 AM
Post: #2
RE: Entering (and losing) programs on HP 48
(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.
Visit this user's website Find all posts by this user
Quote this message in a reply
01-12-2021, 03:42 AM
Post: #3
RE: Entering (and losing) programs on HP 48
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.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
01-12-2021, 04:11 AM
Post: #4
RE: Entering (and losing) programs on HP 48
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.
Find all posts by this user
Quote this message in a reply
01-12-2021, 06:00 AM
Post: #5
RE: Entering (and losing) programs on HP 48
A program is not stored as a string, so if it can't be parsed, the calculator doesn't know how to store it.
Visit this user's website Find all posts by this user
Quote this message in a reply
01-12-2021, 06:35 PM
Post: #6
RE: Entering (and losing) programs on HP 48
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
01-13-2021, 04:32 AM
Post: #7
RE: Entering (and losing) programs on HP 48
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.
Find all posts by this user
Quote this message in a reply
01-13-2021, 10:38 AM
Post: #8
RE: Entering (and losing) programs on HP 48
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!
Find all posts by this user
Quote this message in a reply
01-13-2021, 11:38 AM (This post was last modified: 01-13-2021 11:40 AM by C.Ret.)
Post: #9
RE: Entering (and losing) programs on HP 48
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 !
Find all posts by this user
Quote this message in a reply
01-13-2021, 12:34 PM
Post: #10
RE: Entering (and losing) programs on HP 48
(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.
Visit this user's website Find all posts by this user
Quote this message in a reply
01-16-2021, 01:37 PM
Post: #11
RE: Entering (and losing) programs on HP 48
(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?
Find all posts by this user
Quote this message in a reply
01-16-2021, 01:59 PM
Post: #12
RE: Entering (and losing) programs on HP 48
(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.
Visit this user's website Find all posts by this user
Quote this message in a reply
01-16-2021, 06:43 PM
Post: #13
RE: Entering (and losing) programs on HP 48
(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?
Find all posts by this user
Quote this message in a reply
01-16-2021, 07:18 PM
Post: #14
RE: Entering (and losing) programs on HP 48
(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).

<0|ΙΈ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: