[35s] Program Err Trapping
04-24-2016, 08:40 AM (This post was last modified: 04-24-2016 02:41 PM by brianddk.)
Post: #1
 brianddk Junior Member Posts: 24 Joined: Apr 2016
[35s] Program Err Trapping
I've noticed on other models (and simulators) there are flag configurations that would effectively amount to 'Continue On Error'. For the hp42s, this would refer to flag 25 (User's Guide pg 275).

Although there are 'Halt on Overflow' flags in the 35s (flags 5,6 page 14-9), they only seem to control overflow and don't seem to have a 'Continue on Error' setting. This makes it very difficult to trap for errors in your programs. My only workaround is a Kludge.

Say for example you have to take a square-root, and you know it will only work on reals, not vectors or complex numbers. Since there doesn't appear to be a CPLX? or VECT? instruction, you have to produce some way to trap these errors. Best I can come up with is to make programs Restartable with user flags. Here's an example:

Code:
T001 LBL T          ;Main Routine T002 FS? 0          ;Check to see if we have been restared T003 GTO T007       ;.. if so, go to Flag_0 restart point T004 SF 0           ;Enter danger zone T005 SQRT(X)        ; dangerous operation T006 CF 0           ;Leave danger zone T007 FS? 0          ;Flag_0 Restart point T008 XEQ T011       ;If flag was set, we must have restarted T009 42             ;All code gets here, even errors T010 RTN            ;Return the answer to everything. ;  ; Error Trap Code ; T011 SF 10          ;Prepare to display msg T013 FOUND BUG      ;Display message T014 PSE            ;.. temporarily T015 CF 10          ;Unset our flags T016 CF 0           ;.. all of them T017 RTN            ;Done with trap, continue prog
When you run this with a real in STKX, then everything goes fine. But if you run it with a VECT or IMAG in STKX, then you will see an INVALID DATA message, as well as a FLAG_0 annunciator. If you then rerun PRGM_T then it will restart realizing FLAG_0 was never cleared, so an error must have occurred at T005

Since the flag annunciators are visible this at least lets the user know that something happened, and they should do something (like rerun the PRGM).

This is the best I can come up with to trap for errors in my programs.

Anyone have a better way for the 35s?

MyCalcs: Physical: {hp48gx, hp50g, hp35s} Emu: {hp42s(Free42), hp41c(v41)}
Blog: https://brianddk.github.io/
 « Next Oldest | Next Newest »

 Messages In This Thread [35s] Program Err Trapping - brianddk - 04-24-2016 08:40 AM RE: [35s] Program Err Trapping - brianddk - 04-24-2016, 02:44 PM RE: [35s] Program Err Trapping - Dieter - 04-24-2016, 03:09 PM RE: [35s] Program Err Trapping - brianddk - 04-29-2016, 10:45 PM

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