HP Forums

Full Version: EXIT in wp34s
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I seem to recall some discussion of the EXIT command, possibly with regard to exiting menus and such. If the following discussion is repetitious or the answers can be found in the manual, please accept my apologies. I looked (possibly too briefly) through the manual and found the following information regarding the EXIT function:

Mode           Remarks
Catalog Open Leaves the catalog without executing anything.
Input Pending Cancels the execution of pending operations, returning
to the calculator status as it was before.
\PRG & pro- Stops the running program like R/S below.
gram running
PRG Leaves programming mode like h-P/R below.
Else Does nothing

In several cases it seems that EXIT returns the program pointer to step 000.

Based on my usage, I observe the following behavior:

Mode           Remarks
Catalog Open Leaves the catalog without executing anything.
Input Pending Cancels the execution of pending operations, returning
to the calculator status as it was before except returns
program pointer to step 000.
\PRG & pro- Stops the running program like R/S below.
gram running
PRG Leaves programming mode like h-P/R below except returns
program pointer to step 000.
Else Returns program pointer to step 000.

Also when used as the ON key (i.e., pressing EXIT when the calculator is off) it turns the calculator on and returns the program pointer to step 000.

If the above is correct, I would like to propose that EXIT only return the program pointer to step 000 in the "Else" case above, i.e.:

Mode           Remarks
Catalog Open Leaves the catalog without executing anything.
Input Pending Cancels the execution of pending operations, returning
to the calculator status as it was before.
\PRG & pro- Stops the running program like R/S below.
gram running
PRG Leaves programming mode like h-P/R below.
Else Returns program pointer to step 000.

Included in the above request is that when turning the calculator on, it comes on with the program pointer where it was when it was turned off, although it is OK with me to leave programming mode if the calculator was turned off in programming mode.

The program counter is stored in non volatile memory so your wish to leave it untouched on power off should be achievable. You probably just hit an unwanted behavior. We've to check that.

Jeff, the observed (re)setting of the program pointer to 000 is definitively not intended. Some reasons you mentioned already. So - congratulations! - you found another bug :-?

Walter

Yep, the PC is being reset. Easy to fix.

What about the subroutine return stack? Should that be preserved over EXIT to exit program mode?


- Pauli

Quote:
So - congratulations! - you found another bug :-?

Yay! (Glad to not be asking for something special just for me for once.)

I may misunderstand, but if you are in program(ming?) mode, is the subroutine return stack even active? If you use EXIT to stop a running program, I would say the subroutine return stack should be preserved, assuming this happens if you stop with R/S. Pressing EXIT again would reset the program counter and clear the subroutine return stack. Maybe.

Nothing stops you press R/S to stop execution, entering program mode, exiting program mode and pressing R/S to continue.

At least currently.


- Pauli

Please note that R/S is the normal key to stop execution of a running program as it has been since the HP-65. The key EXIT is just another channel to reach the same, introduced because of the fact 1/3 of our team wanted it and 2/3 didn't care ;-)

Walter

:-)

I agree with Jeff that EXIT shouldn't do any harm to the return stack or the program counter if used to stop a program. We have CLP to do the latter, do we want EXIT to do the same? It may be of some value or not.

I normally use RTN to end a program: LBL A; do somthing; RTN. If I start this from the keyboard, I assume that the return brings me back to keyboard entry mode. If I had stopped a running program before with the return stack active, what will happen if I press A? Maybe XEQ or its implicit variant if entered from the keyboard shall clear the return stack and EXIT leave it as is?

Quote:
EXIT shouldn't do any harm to the return stack or the program counter if used to stop a program. We have CLP to do the latter,
?! Gosh, hopefully not :-?
Quote:
do we want EXIT to do the same?
Depends ...
Quote:
It may be of some value or not.
For sure! ;-)
Quote:
I normally use RTN to end a program: LBL A; do somthing; RTN. If I start this from the keyboard, I assume that the return brings me back to keyboard entry mode. If I had stopped a running program before with the return stack active, what will happen if I press A? Maybe XEQ or its implicit variant if entered from the keyboard shall clear the return stack and EXIT leave it as is?

I'd expect pressing 'A' or XEQ A will call this routine, starting at its very beginning, regardless of the return stack status before. KISS. YMMV

Walter

I see that EXIT behavior has been changed in revision 905. Thanks! Two minor issues:

1. It seems that now EXIT does nothing regarding the program counter, ever. Would it be possible (and/or desirable, opinions welcome) to have it return the program counter to step 000 only when in calculation mode (i.e., not in programming mode or while a program is running). I see that GTO .. returns the PC to 000, but that takes four keystrokes vs. one if using EXIT in this particular case would do it, might be a nice shortcut.

2. In programming mode, would it be possible (and/or desirable, opinions welcome) to have EXIT cancel pending input and remain in programming mode after pressing commands such as STO, RCL, XEQ, GTO and especially whilst in alpha entry mode? In other words, the same behavior as if you want to get out of a menu while in programming mode. I realize that the back-arrow will do what I want for STO, RCL, XEQ, GTO, but the only way out of alpha mode while remaining in programming mode is f-alpha.* (Two keystrokes vs. one if EXIT could stay in programming mode, yes I guess I am lazy.)

* edit - I was incorrect here. Alpha mode can be exited by simply pressing ENTER.


Edited: 19 May 2011, 12:26 p.m. after one or more responses were posted

Two humble answers:

  1. As mentioned, EXIT is often just an additional channel to access some traditional functions. Then it does what the original function does. I'll check for a lazybone's way to reset the program pointer - I think there was one at least.
  2. That's the curse of context sensitive multiple functionality :-( Looking to the description of EXIT in the manual, it should do what you want provided we swap the sequence/priorities of R/S and ENTER there. Correct?
Walter

Edited: 19 May 2011, 10:48 a.m.

Sorry, I missed that ENTER takes you out of alpha mode, so that is an easy single keystroke solution. Not quite sure what you mean by "swap the sequence/priorities of R/S and ENTER."

Quote:
Not quite sure what you mean by "swap the sequence/priorities of R/S and ENTER."

You may have noted the arrow right of [EXIT] on page 53 in colummn 1 of the table. This means the conditions in column 2 will be tested top down for this key. In pseudo code:
if (EXIT is pressed)
then begin
if (a catalog is open)
then (leave it without executing anything)
else if (there's any input pending)
then (cancel the execution of the respective operation ...)
else if (...)
then (...)
else if (...)
then (...)
else if (...)
then (...)
else (do nothing)
end {of EXIT conditions checking}
So the sequence of conditions listed is important.

Walter

Quote:
As mentioned, EXIT is often just an additional channel to access some traditional functions. Then it does what the original function does. I'll check for a lazybone's way to reset the program pointer - I think there was one at least.

In any mode: GTO . . resets the program counter to 0. Since that is too many keystrokes for the lazy we have another shortcut in run mode: CLP. Just like many HP machines.


- Pauli

Quote:
That's the curse of context sensitive multiple functionality :-( Looking to the description of EXIT in the manual, it should do what you want provided we swap the sequence/priorities of R/S and ENTER there. Correct?

I wouldn't bother mucking with this.

Use the back space key to clear partial entries and you'll be happy.


Pauli

Yes I saw the arrow, I though it just meant that the command applied in several modes of operation or conditions. I see what you are saying now. Based on subsequent posts, no need to do anything else.

Edited: 19 May 2011, 8:50 p.m.