[WP34s] Question about ERR



#8

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


#9

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.


#10

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


- Pauli


#11

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


#12

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.


#13

A program stopping should clear the entry flag.

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


- Pauli

#14

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.


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

Forum Jump: