[WP34s] Question about ERR


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?



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.


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

- Pauli


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 ...



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.


A program stopping should clear the entry flag.

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

- Pauli


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!? ;-))


Possibly Related Threads...
Thread Author Replies Views Last Post
  Simple? programming question [WP34S] Shawn Gibson 3 1,085 03-15-2013, 11:56 AM
Last Post: Didier Lachieze
  [wp34s] xtal question jerome ibanes 9 2,065 02-05-2013, 05:35 PM
Last Post: Massimo Gnerucci (Italy)
  [WP34S] WP34S firmware on the AT91SAM7L-STK dev kit? jerome ibanes 1 855 10-04-2012, 04:59 PM
Last Post: Paul Dale
  more question regarding complex operations using complex number on wp34s wildpig 22 3,786 09-02-2012, 12:54 PM
Last Post: Walter B
  WP34S solver question Reth 22 4,368 07-13-2012, 06:55 PM
Last Post: Paul Dale
  WP34s Flash Question rgray 18 3,590 06-19-2012, 03:20 AM
Last Post: Cristian Arezzini
  Another stupid WP34S question Geoff Quickfall 2 945 06-16-2012, 11:21 PM
Last Post: Geoff Quickfall
  WP34S beginner question Geoff Quickfall 8 1,831 06-08-2012, 09:55 PM
Last Post: geoff quickfall
  [WP34s] Assembler question fhub 6 1,586 05-14-2012, 03:08 PM
Last Post: Marcus von Cube, Germany
  WP34S program question Mike Maiorana 12 2,358 04-05-2012, 03:09 AM
Last Post: Steve Simpkin

Forum Jump: