The Museum of HP Calculators

HP Forum Archive 20

[ Return to Index | Top of Index ]

[WP34s] Question about ERR
Message #1 Posted by fhub on 23 Oct 2011, 6:08 p.m.

Is it possible that the ERR command is changing or destroying the return stack? :-(

In my main program I call a subroutine (with XEQ 81) and this subroutine makes a loop with a maximum of 100 runs. If the this loop reaches the desired accuracy before the counter is at 100, it makes a usual RTN and everything is working fine.
But if the counter reaches 100 I have a ERR 20 statement and a GTO 81 just after it, so if I just press R/S when the error message appears it repeats this subroutine (GTO 81) and should try another 100 iterations.
Now if within these next 100 iterations the accuracy is ok, then it goes to the RTN command again and so should return to the main program - but it doesn't! :-(
It jumps to the very first program step as if this RTN in the subroutine would be the RTN in the main program.

So I'm wondering if this ERR command has any effect on the return stack? Maybe it resets this stack?

Franz

      
Re: [WP34s] Question about ERR
Message #2 Posted by Marcus von Cube, Germany on 24 Oct 2011, 3:19 a.m.,
in response to message #1 by fhub

If I read the code correctly, ERR should not kill the stack but it decrements the program counter which is probably not what you want. Clearing the return stack might be a side effect which is not intended. I have to verify this.

Edit: I just found the piece of code that resets the return stack pointer. I cannot easily change this because an error in XROM might leave you in an illegal state. I'll discuss this with Pauli.

Edited: 24 Oct 2011, 4:00 a.m.

            
Re: [WP34s] Question about ERR
Message #3 Posted by Paul Dale on 24 Oct 2011, 4:00 a.m.,
in response to message #2 by Marcus von Cube, Germany

Clearing the return stack on a hard error is the intended behaviour. At least until the triumvirate is convinced otherwise :-)

- Pauli

                  
Re: [WP34s] Question about ERR
Message #4 Posted by fhub on 24 Oct 2011, 4:42 a.m.,
in response to message #3 by Paul Dale

Quote:
Clearing the return stack on a hard error is the intended behaviour. At least until the triumvirate is convinced otherwise :-)
Well, I would say using the ERR command in a program is a bit different to a 'hard error' produced by the XROM (because of an illegal operation).
If the programmable ERR command does really reset the return stack, then this command is almost useless for own programs.

So please rethink again your position about this issue ...

Franz

                        
Re: [WP34s] Question about ERR
Message #5 Posted by fhub on 24 Oct 2011, 5:04 a.m.,
in response to message #4 by fhub

One more thing about ERR:

Yesterday I've even checked if an ERR command in my program would clear the ENTRY? flag - I hoped it would do it and in fact it did! :-)

So it's very comfortable to check if the user has entered any new value before pressing R/S on an intentional ERR command in the program to decide what to do afterwards. But if ERR has this side-effect of clearing the return stack then all this won't work of course.

                              
Re: [WP34s] Question about ERR
Message #6 Posted by Paul Dale on 24 Oct 2011, 5:40 a.m.,
in response to message #5 by fhub

A program stopping should clear the entry flag.

If it doesn't it is a bug that will be fixed.

- Pauli

                        
Re: [WP34s] Question about ERR
Message #7 Posted by fhub on 24 Oct 2011, 7:07 a.m.,
in response to message #4 by fhub

Quote:
So please rethink again your position about this issue ...
Oh, I just see that my request was granted - very nice, thanks! :-)

Now my Polynomial RootSolver is indeed ready. The only problem left is to improve the convergence speed a bit, because as Marcus told me a real HP-20b/30b is quite slow on some bad-conditioned polynomials.
But I've already an idea to solve this speed problem. Unfortunately it will need still more program steps (currently about 250), and I hoped I could put this PRS program together with my TVM-Solver into one flash region. :-(
(well, maybe I should make the input and output a bit less comfortable!? ;-))

Franz.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall