Post Reply 
HP 41 - branching to local label and return stack - FINAL RESULTS AND PROGRAMS
05-20-2019, 11:18 PM (This post was last modified: 05-20-2019 11:33 PM by Artur - Brasil.)
Post: #19
RE: HP 41 - branching to local label and return stack
(05-20-2019 10:03 PM)Garth Wilson Wrote:  I've been using GETKEY. This is a portion from a program I've been using for decades:

Code:
LBL 43  "GET F,X,L,C ESC"   AVIEW    \ "OK" in entry menu comes here.  Calc: key numbers here are 21, 64, 33, 13, and 15.
LBL 10   GETKEY   10 +
         SF 25   GTO IND X   GTO 43  \ If no key is pressed, GETKEY gives 0, you add 10, and loop again.  Invalid key will
                                     \ flash display once and repeat.  GTO 43, not 10 because of LCD rotate bug.

GETKEY does not stop the program, so you shouldn't lose your return stack contents (although I don't remember if I've tried it). The "add 10" part was to keep key numbers from conflicting with local-label keys, IIRC. The SF 25 is there so GTO IND X won't stop if there's no label that corresponds to the number of the key that was pressed.

Here's a slightly strange thing about it. If you don't press a key within ten seconds, it moves on (with 0 in X). If there was no key pressed whose key number matches a numerical label, I have it go around again to keep waiting. If you press a key in the short time it takes to make its way back around to re-start GETKEY, it won't see it, and you'll have to press it again.

Hey, man, we really had the same thinking path!!
I tried this after posting my question here. Even the 10+ I did, but, for simple menu of functions it would work fine, but, going down on program, you will see others short alpha labels. Those expect three kinds of typing as I explained before: number and letter key, just letter key and R/S. This would be impossible to treat with GETKEY.
By the way, GETKEY waits for about 10s and resume if no key is pressed with code 0. I just put it in a loop: while code is 0, repeat.

Hard to find a solution, isn't it?
First I gave a chance to my 41 changing its battery system. ok
So, I get more confidence in programming it, but memory was short... so I started using X-memory and GETP.
But such programms with so many labes become large and again the memory problem.
Diego Dias come to help with this beautiful NovRAM. No more memory trouble.
Now, this almost impossible trouble with a simple RTN...
Or I study engineering or HP41, I'm exausting my forces...
But hope is the last to loose: I reset the machine and keyed the ByteGrabber routine for starting with synthetics ...

Best wishes!
Artur

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 11:18 PM



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