[WP34s] Question about ERR - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: [WP34s] Question about ERR (/thread-202723.html) |
[WP34s] Question about ERR - fhub - 10-23-2011 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. 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 - Marcus von Cube, Germany - 10-24-2011 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 - Paul Dale - 10-24-2011 Clearing the return stack on a hard error is the intended behaviour. At least until the triumvirate is convinced otherwise :-)
Re: [WP34s] Question about ERR - fhub - 10-24-2011 Quote: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 - fhub - 10-24-2011 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 - Paul Dale - 10-24-2011 A program stopping should clear the entry flag. If it doesn't it is a bug that will be fixed.
Re: [WP34s] Question about ERR - fhub - 10-24-2011 Quote: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.
Franz.
|