Posts: 1
Threads: 1
Joined: Jan 1970
Hi,
I am trying to reverse engineer a formula from from an HP67 programme. Most of it is pretty clear, however I don't understand what the following program steps from 38 to 45 are doing so can anybody help:
037
038 STO1
039 CHS
040 2
041 ENT
042 Pi
043 x
044 +
045 STO2
046
Thanks,
Bob
Posts: 184
Threads: 1
Joined: May 2006
It looks like whatever is in X gets stored to register 01 then X is sign-changed, added to 2pi and stored to register 02.
Posts: 1,755
Threads: 112
Joined: Jan 2005
Hi, Bob:
Assuming you've got a value, say N, in the display (X register)
at the beginning, after you execute these steps you'll have:
In Register 1:
N
In both Register 2 and the display (X register):
-N + 2*Pi
but you should delete step 041 ENT, (assuming you mean ENTER),
because ENTER isn't needed to separate the numeric entry "2"
from the constant value "Pi".
Best regards from V.
Posts: 1,830
Threads: 113
Joined: Aug 2005
Quote:
but you should delete step 041 ENT, (assuming you mean ENTER),
because ENTER isn't needed to separate the numeric entry "2"
from the constant value "Pi".
Doesn't that ENTER mean that you would have
- R1 = N
- X = 2Pi+2
- Y = -N
- R2 = 2Pi +2
I'm on the opposite North American coast from my 67, but I have my 41 with me. That distribution is what I get when I run the following program:
- 01 LBL 'TST
- 02 STO 01
- 03 CHS
- 04 2
- 05 ENTER^
- 06 PI
- 07 *
- 08 +
- 09 STO 02
Regards,
Howard
Posts: 1,755
Threads: 112
Joined: Jan 2005
Hi, Howard:
Howard posted:
"Doesn't that ENTER mean that you would have
R1 = N
X = 2Pi+2
Y = -N
R2 = 2Pi +2
It depends on whether [ENTER] disables stack lift for the
following numeric entry (so that it overwrites the contents
of the X register) *AND* [PI] is considered a numeric entry
key in the HP-67, which I can't test right now.
I assumed that either that's the case (so that [ENTER], [PI]
does overwrite X) or the original coder wrongly thought it
did, because frankly I find much more plausible that he is trying to compute:
-N + 2*Pi
which is frequently seen as part of many computations, than:
2*Pi + 2
which seems pretty useless to me.
Best regards from V.
Posts: 3,283
Threads: 104
Joined: Jul 2005
Quote:
It depends on whether [ENTER] disables stack lift for the following numeric entry (so that it overwrites the contents of the X register) *AND* [PI] is considered a numeric entry key in the HP-67, which I can't test right now.
That's exactly the case on my 97 so it should be the same for the 67.
Marcus
Posts: 1,755
Threads: 112
Joined: Jan 2005