Post Reply 
Bug in the HP-41 with R/S and stack lift
11-02-2020, 08:09 PM
Post: #21
RE: Bug in the HP-41 with R/S and stack lift
(11-02-2020 01:15 PM)Ángel Martin Wrote:  I keep assuming that ST+ puts the X value in LastX, which it does not.... counter-intuitive for me.

Why? The register arithmetic functions are guaranteed not to change the value of X (unless you count ST+ X etc.), so why would they copy X into LASTx?
Visit this user's website Find all posts by this user
Quote this message in a reply
11-02-2020, 08:59 PM
Post: #22
RE: Bug in the HP-41 with R/S and stack lift
(11-02-2020 01:15 PM)Ángel Martin Wrote:  I keep assuming that ST+ puts the X value in LastX, which it does not.... counter-intuitive for me.

Counter-intuitive ? Why ?

In general, only instructions that do change X are expected to copy the previous value of X to the LastX register.

As STO operations do not change the value in X (except if X is the addressed register, of course) they should not copy the contents of the X register to LastX. That would be counter-intuitive, and wrong. On the other hand, RCL+, RCL-, RCLx and RCL/ do change X and thus the previous X is indeed copied to LastX, as it should.

You're getting old, Ángel. Smile

Best regards.
V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
11-03-2020, 12:34 AM
Post: #23
RE: Bug in the HP-41 with R/S and stack lift
STO + X

and

RCL + X

differ in what way? Last X ?
Find all posts by this user
Quote this message in a reply
11-03-2020, 12:43 AM
Post: #24
RE: Bug in the HP-41 with R/S and stack lift
(11-03-2020 12:34 AM)Gene Wrote:  STO + X

and

RCL + X

differ in what way? Last X ?

Correct. Both replace X with 2*X, but RCL+ ST X copies the original X to LASTx while STO+ ST X does not.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-03-2020, 06:37 AM (This post was last modified: 11-03-2020 06:40 AM by Ángel Martin.)
Post: #25
RE: Bug in the HP-41 with R/S and stack lift
(11-02-2020 08:59 PM)Valentin Albillo Wrote:  
(11-02-2020 01:15 PM)Ángel Martin Wrote:  I keep assuming that ST+ puts the X value in LastX, which it does not.... counter-intuitive for me.
You're getting old, Ángel. Smile

No dispute here ;-)

I meant to write ST+ X

hopefully it now makes sense to y'all pack of wolves ... Smile

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
11-03-2020, 06:23 PM
Post: #26
RE: Bug in the HP-41 with R/S and stack lift
.
Hi, Ángel:

(11-03-2020 06:37 AM)Ángel Martin Wrote:  
(11-02-2020 08:59 PM)Valentin Albillo Wrote:  You're getting old, Ángel. Smile

No dispute here ;-)

For the record, I'm older. Smile

Quote:I meant to write ST+ X

Ah, now it makes sense.

Quote:hopefully it now makes sense to y'all pack of wolves ... Smile

I might be a wolf but certainly a mindreader I'm not. Wink

Best regards.
V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
11-05-2020, 05:57 PM
Post: #27
RE: Bug in the HP-41 with R/S and stack lift
(10-31-2020 06:03 PM)hth Wrote:  I think that normally you want stack lift to be enabled when pressing R/S, as it allows two identical numbers to be entered on the stack like:

Code:
42
ENTER
RUN

You expect this to be two numbers when starting the program and it should be allowed for the program to push a number the first thing it does without disrupting your two entered values. That is consistent with any built in function like PLUS.

I agree, this is how it works on the 41C. But I checked several HP calculators (physical ones or emulators) and I was surprised to find that on most of the calculators tested from the HP-65 to the HP-35S, R/S is neutral vs. stack lift, with two exceptions: HP 41C and WP 34S where R/S enables the stack lift.

I used the following program:

2
+
STOP

Before running the sequence with R/S, the stack was initialized with :

3
ENTER
CLx

So the stack is initialized with 0 in X, 3 in Y and stack lift is disabled.
If R/S is neutral vs stack lift, then when running the sequence 2 + STOP, the 2 will replace the 0 in X without lifting the stack, then it will be added to the 3 in Y for a result of 5
If R/S enables stack lift, then when running the sequence 2 + STOP, the 2 will be entered in X and lift the stack, pushing the 0 in Y, and the 3 in Z, then the 2 in X will be added to the 0 in Y for a result of 2

Here are the results with also what is mentioned (or not) in the manual for each calculator :

Code:
        Result   Stack Lift when     Manual description    Manual Section
                starting a program
HP-65     5         Neutral          Neutral (default)*    General Operations : Stack Lift Enable/Disable
HP-55     5         Neutral          Neutral operations    Appendix B : Additional Operating Information
                                      not described
HP-25     5         Neutral          R/S not listed        Appendix C : Stack Lift and LAST X
HP-29C    5         Neutral          Neutral               Appendix C : Stack Lift and LAST X
HP-67     5         Neutral          Enable**              Appendix D : Stack Lift and LAST X
HP-33E/C  5         Neutral          Neutral               Appendix D : Stack Lift and LAST X
HP-34C    5         Neutral          Neutral               Appendix E : Stack Lift and LAST X
HP-38E/C  5         Neutral          -                     Stack lift not mentioned in the manual
HP-41C    2         Enable           Enable (default)      Appendix C : Stack Lift Conditions and Termination of Keyboard Entry
HP-10C    5         Neutral          Neutral               Appendix A : Stack Lift and LAST X
HP-11C    5         Neutral          Neutral               Appendix B : Stack Lift and LAST X
HP-12C    5         Neutral          R/S not listed        Appendix A : The Automatic Memory Stack
HP-15C    5         Neutral          Neutral               Appendix B : Stack Lift and the LAST X Register
HP-16C    5         Neutral          Neutral               Appendix B : Classes of Operations
HP-32S    5         Neutral          Neutral               Appendix B : User Memory and the Stack
HP-32SII  5         Neutral          Neutral               Appendix B : User Memory and the Stack
HP-42S    5         Neutral          -                     No specific section
HP-33S    5         Neutral          Neutral               Appendix B : User Memory and the Stack
HP-35S    5         Neutral          Neutral               Appendix B : User Memory and the Stack
WP 34S    2         Enable           -                     No specific section

* In the HP-65 manual R/S when executed in a program is not listed as an operation enabling or disabling stack lift, 
so it is neutral by default 
** There is a quirk in the HP 67 documentation, because on this calculator R/S is neutral when used to start a program but in the Appendix D 
of the manual R/S is included in the instructions for which "A number keyed in following one of these operations lifts the stack" 
and not in the instructions for which "A number keyed in following one of these keys does not affect the stack".
Find all posts by this user
Quote this message in a reply
11-23-2020, 06:12 PM
Post: #28
RE: Bug in the HP-41 with R/S and stack lift
Interesting list, I have stewed on it for a while. It is clear that the majority is neutral and the HP-41 is a bit of an oddball here. I kind of think this was not intended behavior and would have been changed if pointed to early on in development. I think the case of stopping, viewing something, restore and resume operation should not affect program result (only visuals on the display as it clears any message shown).

I will leave this and not mess with it for now. It has not been seen as a problem in the past and people seem quite divided about it.
Find all posts by this user
Quote this message in a reply
11-23-2020, 06:36 PM
Post: #29
RE: Bug in the HP-41 with R/S and stack lift
(11-05-2020 05:57 PM)Didier Lachieze Wrote:  Here are the results with also what is mentioned (or not) in the manual for each calculator :
...
HP-55 5 Neutral Neutral operations Appendix B : Additional Operating Information
not described

On page 82 of the hp55 Owner’n Handbook there is an interesting statement:

“Pressing any key( even accidentally) halts program execution. If a program has been stopped by pressing a key, be careful not to restart program execution in the middle of a digit entry key sequence within the program or between a prefix key and the corresponding operation. Use BST or SST to reposition the program pointer in either of these cases” (bold typeface by me)

I think, it describes the discussed problem clearly.

Roland
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)