Post Reply 
Little explorations with HP calculators (no Prime)
03-16-2018, 08:29 PM
Post: #272
RE: Little explorations with HP calculators (no Prime)
(03-16-2018 07:48 PM)pier4r Wrote:  Question to the RPN masters. Can one pass functions to a RPN program? For example a label that then is used by the program to recall another program. In other words the main program doesn't know a priori which other program to call, this will be defined by the value of an argument.

Sure. This has been done since the Seventies when the first programmable calculators with indirect addressing were available.

You can pass a label number on the stack, or with calculators like the HP41/42 a program name in alpha, and this can then be called indirectly.

Example for HP41: call an equation solver with two guesses (1 and 2) in X and Y and the function to solve ("MYFUNC") in alpha

1
ENTER
2
"MYFUNC"
XEQ "SOLVE"
...

LBL "SOLVE"
STO 02
X<>Y
STO 01
ASTO 00
RCL 01
XEQ IND 00
STO 03
RCL 02
XEQ IND 00
STO 04
...

LBL"MYFUNC"
X^2
2

RTN

You can even do this with an HP67: simply pass the label number. The called program stores this in register I and then does a GSB i. This is also possible for LBL A ... LBL e which are encoded with index 10...19.

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


Messages In This Thread
RE: Little explorations with HP calculators (no Prime) - Dieter - 03-16-2018 08:29 PM



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