Post Reply 
hp41cx named variables in extended memory
02-28-2020, 02:27 PM (This post was last modified: 02-28-2020 02:59 PM by Artur - Brasil.)
Post: #9
RE: hp41cx named variables in extended memory
Hi, guys!

Here is the code for creating numeric registers in X-Memory, version 1. No use of flag 10.

Version 1 - stores from 00 to nnnnnn, limited only to program memory and X-Memory available.

Main program: creates the X-file to hold numeric registers, given ALPHA: file name X:number of registers (ex: 15 - will be available 00 to 14)
LBL "XREG"
SF 25
CRFLD
FC?C 25
RSZFL if file already exists, resize it, in case you have changed to a bigger os smaller file
CLX
SEEKPTA
RTN

LBL "R0" global labels for Restoring (RCL) - just call them in your program or from keyboard
0
GTO 00
LBL "R1"
1
GTO 00
LBL "R2"
2
GTO 00
... repeat LBL "Rnnnn" as many times your biggest neccessity of storage registers
... but be aware we are calling a local label, so, distance from fist GTO 00 must be
... less than 112 Byte
... my experience showed that you can create up to R10 and this limitation will be
... preserved. After routine LbL 00, you can resume LBL "R11" up to "R19" and distance
... will be less than 112Byte

LBL "R2"
10 the last routine just befor LBL 00 doesn't need the GTO 00 instruction!
LBL 00 local subroutine to make the restoring work - preserves Y,Z,T stack registers, as STO
SEEKPT
CLX
GETX
RTN
... as told before, you can continue with "R11" up to "R19" here, if desired. Let's put two ex.
LBL "R11"
11
GTO 00
...
LBL "R19"
19
GTO 00 well, if you need more registers, for each group of nine (R20-R28, R29-37, ...) you
must replicate the LBL 00 subroutine as LBL 02, LBL 03, for example, and change the GTO 00 to GTO 02, GTO 03 too. The distance limitation will be preserved.

LBL "S0" here we star the restoring global labels. As "Snn", just call them from programs or k.
X<> L Storing is more complicated and consumes more bytes, but preserves stack, as STO
CLX
0
GTO 01
LBL "S1"
X<> L
CLX
1
GTO 01
... again, insert as many "Snn" routines as you have created "Rnn". The distance limitation for GTO 01 exists too. You can put up to "S9" before the subroutine LBL 01
LBL "S9"
X<> L
CLX
9 the last routine just before LBL 01 doesn't need the GTO 01 instruction!
LBL 01 here the routine which saves the X contents.
SEEKPT
X<> L
SAVEX
RTN
... as told before, you can continue with "S10" up to "S17" here, if desired. Let's put one ex.
...
LBL "S17"
X<> L
CLX
17
GTO 01
well, if you need more, for each group of seven (S18..S24, S25..31...) you
must replicate the LBL 01 subroutine as LBL 05, LBL 06 and change GTO 01 to GTO 05, GTO 06... The distance limitation will be preserved.

END

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


Messages In This Thread
RE: hp41cx named variables in extended memory - Artur - Brasil - 02-28-2020 02:27 PM



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