Post Reply 
HP 35S Error Handling
10-31-2017, 05:57 PM (This post was last modified: 10-31-2017 05:57 PM by Dieter.)
Post: #2
RE: HP 35S Error Handling
(10-28-2017 04:04 PM)JeremyBeck Wrote:  Is there a way to handle an error without halting a program?

No. The only way to control error messages is the use of flag 5/6. If flag 5 is set, an overflow error will not just briefly display "OVERFLOW" and then continue (default) but the program will be stopped.

Otherwise there is nothing like the HP41's error flag 25.

(10-28-2017 04:04 PM)JeremyBeck Wrote:  For example the following will produce an INVALID (I) message if there is no value in (i) and halt the program:

The program will not produce an error if register (I) is empty. Instead an error will occur if register (I) is not assigned (!).

By default there are no indirect registers at all. Only if you store a non-zero number in register n, all registers from 0 to n will be allocated. For instance 20 STO I and then 111 STO(I) will allocate 21 indirect registers from R000 to R020. So if you plan to use registers from 0 to 100, simply store a value in R100 (or better: in R101) and all registers up to R100 become available. At least unless you run out of memory.

(10-28-2017 04:04 PM)JeremyBeck Wrote:  I am looking for a way to let the user know that there was an error and to try again. Any help would be much appreciated.

I fear there is not much you can do in this regard.

(10-28-2017 04:04 PM)JeremyBeck Wrote:  I did notice that execution is halted at the offending line and if R/S is pressed the error will come up again.

Sure. In this case the R/S tries again to execute the command that caused the error. So of course the same error occurs again.

For the case you mentioned you could initially define a maximum number for I that is stored somewhere (e.g. 100 STO M) and allocate this number of registers by

RCL M
1
+
STO I
STO(I)

This stores 101 in R101 so that R000...R100 are available for your data. Then, after the INPUT I prompt, simply check if the entered value is ≤ M.

Code:
I001 LBL I
I002 100
I003 STO M
I004 1
I005 +
I006 STO J
I007 STO(J)
I008 INPUT I
I009 RCL M
I010 RCL I
I011 X>Y?
I012 GTO I008
I013 ...

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP 35S Error Handling - JeremyBeck - 10-28-2017, 04:04 PM
RE: HP 35S Error Handling - Dieter - 10-31-2017 05:57 PM
RE: HP 35S Error Handling - JeremyBeck - 11-02-2017, 11:22 PM
RE: HP 35S Error Handling - Dieter - 11-03-2017, 07:38 AM



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