Post Reply 
HP 41 - branching to local label and return stack - FINAL RESULTS AND PROGRAMS
05-22-2019, 01:50 AM (This post was last modified: 05-22-2019 01:52 AM by Artur - Brasil.)
Post: #26
RE: HP 41 - branching to local label and return stack
Hi, guys!

In a simple test program, the routines worked fine:
The program will show A B (in a subroutine) and user keys A or B. Such branches shall return
1 or 2 to main program, which, in turns, adds 1 to whatever returns.

LBL "AA"
XEQ "BB"
1 // here if RTN from BB works fine, I'll add 1 to the number returned from there.
+
RTN
LBL "BB"
1 //needed by LR - the first of two regs to store a and b
XEQ "LR" // LR kills alpha register, so, I believe it's better call LR before prompting messages
"A B"
PROMPT
LBL A
1 //needed by SR - the first of two regs that stored a and b
XEQ "SR" //gets back the return stack - we hope!
1
RTN // this RTN would never work in a "normal" program
LBL B
1
XEQ "SR"
2
END //won't put RTN where it is not neccessary any more! Whithout shynt instructions,
// program simple would stop here.

It worked very fine!
I'll add the calling for those routines in my soft menu. Unfortunatelly, this will cost a lot of bytes, which were at limit to use short local labels ...
if someone interested in my routine, I'll could explain and give some examples. May be someone could improve it and we finally got a routine for soft menus in 41C!

Many thanks to Sylvain for his precious support - without you, I would retire my 41 again ....

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-22-2019 01:50 AM



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