Starting HP25 programs with numbers
11-24-2017, 09:38 AM (This post was last modified: 11-24-2017 09:40 AM by Dieter.)
Post: #1
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
Starting HP25 programs with numbers
Hi all,

I just encountered an unexpected behaviour in an HP25 program that may be caused by a different way this calculator handles stack lift after number entry. Here are the first lines of the original program:

Code:
01 FIX 4 02 INT 03 2 04 X<>Y 05 - 06 STO 5 ...

This is supposed to store 2–x in R5, and indeed it works fine. Enter x=3, press R/S and 2–3 = –1 is stored in R5.

Now omit the first two lines:

Code:
01 2 02 X<>Y 03 - 04 STO 5 ...

This led to unexpected results. The result stored in R5 seems to depend on other stack content, it looks like the first step does not cause the user entry to get pushed to Y and leave a 2 in X.

The whole thing seems to work if the first line is not a number. I now have found one or two HP25 programs where the first step is NOP preceding a number in the second line. May this be neccessary because the HP25 handles stack lift different from other/later calculators? The HP67 doesn't seem to be affected by this.

Then, similar problems occur with the following version:

Code:
01 CHS 02 2 03 + 04 STO 5 ...

I know that CHS is handled differently in various HP calculators and the above code may result in either X+(–2) or (–X)+2. What does the HP25 do here? I do not have a hardware calculator so I cannot check this. All this showed up in programs for an emulator.

BTW, I see that the HP65 requires a NOP as the conditional tests skip two steps if false, but is there a special reason why the HP25 also features a NOP command?

Dieter
 « Next Oldest | Next Newest »

 Messages In This Thread Starting HP25 programs with numbers - Dieter - 11-24-2017 09:38 AM RE: Starting HP25 programs with numbers - Paul Dale - 11-24-2017, 10:07 AM RE: Starting HP25 programs with numbers - teenix - 11-24-2017, 11:26 AM RE: Starting HP25 programs with numbers - Dieter - 11-24-2017, 12:14 PM RE: Starting HP25 programs with numbers - Thomas Okken - 11-24-2017, 02:07 PM RE: Starting HP25 programs with numbers - PANAMATIK - 11-24-2017, 02:36 PM RE: Starting HP25 programs with numbers - Thomas Okken - 11-24-2017, 03:18 PM RE: Starting HP25 programs with numbers - PANAMATIK - 11-24-2017, 04:17 PM RE: Starting HP25 programs with numbers - teenix - 11-24-2017, 09:25 PM RE: Starting HP25 programs with numbers - Thomas Okken - 11-24-2017, 11:37 PM RE: Starting HP25 programs with numbers - PANAMATIK - 11-24-2017, 11:49 PM RE: Starting HP25 programs with numbers - teenix - 11-25-2017, 12:17 AM RE: Starting HP25 programs with numbers - Dieter - 11-25-2017, 12:49 PM RE: Starting HP25 programs with numbers - teenix - 11-24-2017, 09:11 PM RE: Starting HP25 programs with numbers - teenix - 11-24-2017, 10:01 PM RE: Starting HP25 programs with numbers - PANAMATIK - 11-24-2017, 10:07 PM RE: Starting HP25 programs with numbers - teenix - 11-24-2017, 11:06 PM RE: Starting HP25 programs with numbers - PANAMATIK - 11-24-2017, 11:18 PM RE: Starting HP25 programs with numbers - teenix - 11-24-2017, 11:21 PM RE: Starting HP25 programs with numbers - teenix - 11-24-2017, 11:28 PM RE: Starting HP25 programs with numbers - Dieter - 11-25-2017, 01:10 PM RE: Starting HP25 programs with numbers - PANAMATIK - 11-25-2017, 02:21 PM RE: Starting HP25 programs with numbers - rprosperi - 11-25-2017, 02:34 PM RE: Starting HP25 programs with numbers - PANAMATIK - 11-25-2017, 04:37 PM RE: Starting HP25 programs with numbers - Thomas Okken - 11-24-2017, 11:40 PM

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