Post Reply 
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
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:

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:

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:

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?

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

Messages In This Thread
Starting HP25 programs with numbers - Dieter - 11-24-2017 09:38 AM

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