XEQ and GTO indirect with an alpha label in the register

XEQ and GTO indirect with an alpha label in the register

Postby Garth » Mon May 21, 2018 5:09 am

I've been using my 41cx daily for 32 years, so it's not often that I learn or realize something new about it (other than getting familiar with Angel's outstanding new modules like the 41z and WarpCore). But I just now realized you can put an alpha label name in a register and do XEQ IND <reg> to execute the program portion specified there. I've used XEQ IND X countless times after something like GETKEY or GETKEYX, but not with alpha strings in the register.

My interest is in allowing programs that have something pending to tell the start-up program to run the appropriate portion, which could change from one turn-on to the next, without modifying the auto-start program. (To do the autostart, I have a TOFF ("turn-off") label assigned to the Σ- key, and TOFF sets flag 11 (the autostart flag) before executing OFF. When you turn it back on, program execution resumes automatically with the instruction following the OFF instruction.

Now besides the things it has been doing for decades (shown at http://wilsonminesco.com/HP-41daytimer.html ), I can have other programs tell it if they want something additional, like to display which account my timeclock program is on at the moment (if any) and how much time on it since I clocked in the last time.

It will take another register or two (I can't imagine any reason to give it more than a couple); but if something else is using them instead, chances are nearly zero that the contents would match any label; so trying to execute it with flag 25 (the error-ignore flag) set will result in it simply moving on without doing anything there or generating an error message. If desired, the flag can be tested to see if it was successful.

Actually, as for what registers to use, it makes more sense to do it in a data file, so nothing can step on those label variables. The only problem might be if the file access and reading the records makes it intolerably slow. Currently the complete startup for the program linked above is usually a couple of seconds, sometimes less, depending on what's going on. It's worth it to me.
Garth
Moderator
Moderator
 
Posts: 172
Joined: Tue Jan 20, 2009 1:31 am

Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron