Post Reply 
HP 41 - branching to local label and return stack - FINAL RESULTS AND PROGRAMS
05-20-2019, 05:13 PM
Post: #5
RE: HP 41 - branching to local label and return stack
(05-20-2019 03:41 PM)Dave Britten Wrote:  The typical way I've seen it done (such as in the TVM program on the Advantage module) is to have the appropriate A-E local labels for input/output variables, and another local label (usually J) that displays the soft-menu. To enter values in the variables, just type a value into X and press the corresponding key.
The rough structure of the program would be like this:

LBL "TVM"
...various program-specific setup steps (clear key assignments, turn on USER, etc.)...
XEQ J //Display the soft-menu and stop
RTN
LBL A
FC?C 22 //Check for user input
XEQ "N" //No user input, call the solve/computation routine for this variable
STO 01 //Store X into 01 (n, in the case of TVM), whether user input or the newly computed value
RTN
...similar labels for B-E, and a-e if you want shifted functions...
LBL J
"N I% PV PMT FV"
AVIEW
RTN

This is a pretty user-friendly way to do it that doesn't require a lot of extra program steps, and the UX is very similar to the TVM and soft-menu solvers on other models.

Yes, Dave, this is what I'm trying to do, but I have many equations/formulas (electrical machines and their formulas) to programm. The registers that will keep the variables are previously mapped, so, I was trying to put the menu routines in a separated programm and call it (and a few inner subroutines) as need. The it would be better to put the PROMPT command in that programm, not in the main programm.

ARTUR MARIO JUNIOR
BRAZIL
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP 41 - branching to local label and return stack - Artur - Brasil - 05-20-2019 05:13 PM



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