hp41cx named variables in extended memory
|
03-17-2020, 09:32 PM
(This post was last modified: 03-18-2020 02:48 PM by Artur - Brasil.)
Post: #14
|
|||
|
|||
RE: hp41cx named variables in extended memory
Revison A (mars, 18th)
As promised, although nobody indeed made even any comment about it, here the routine to create named variables in X-memory, complementing the X-Memory numbered registers routine published before. The vars must have a name up to 5 chars. Example: WIDTH. Please, do not use : in variable name. All variables will be saved in a X-files which names you give. Each X-File has no limit for number of variables, only limited to memory available. The use is very simple: put the name of file (to be created or already existing) in ALPHA, by example: BOX. If file does not exist yet, it will be created; if already exists, the program just open it. IMPORTANT: both routines (STA and RCA) make the x-file the current one only at initialization (XVARN). So, if your programs make use of others X-files, you will need to make the X-Reg file the current one again. Call XVARN (X-Variables Named) routine: ALPHA BOX ALPHA XEQ ALPHA XVARN ALPHA Now, you must have one text X-File named BOX. (See cathalog 4 in CX) For creating and saving the variable LEN with value 10, just type: ALPHA LEN ALPHA 10 XEQ ALPHA STA ALPHA. (Store Alpha named variable) Create as many variables your X-Memory modules can hold. Not allowed two variables in the same file with same name. For recovering the contents of any named variable, put its name in ALPHA register and call RCA routine. ALPHA LEN ALPHA XEQ ALPHA RCA ALPHA --> X: 10 I saved variables in X-file as: namen.nnnnnnnnEsnn (s - signal) Numeric values are stored in American and Scientiic format, up to 9 digits of precision. This may lead to something like: LEN:1,200000000E1 which is a waste of precious bytes on 00000000 sequence. So, I created a routine to clean these unneccessary zeroes and compress the file to minimal registers needed. Eventually, call CLNVAR (clear nominal var file), with the current x-file as the one you want to clean or insert a call to it in the XVARN routine. So, it will run when you start the process (remove the VIEW commands in routine CLNVAR. Here is the full code (REV A) 1 LBL "XVARN" 2 X<> L 3 RDN 4 1 5 SF 25 6 CRFLAS 7 CF 25 8 X<> L 9 RTN 10 LBL "STA" 11 X<> L 12 RDN 13 58 14 XTOA 15 RDN 16 POSFL 17 X<0? 18 GTO 02 19 DELREC 20 X<> L 21 LBL 03 22 RCLFLAG 23 RDN 24 SF 28 25 SCI 9 26 ARCL X 27 APPREC 28 RUP 29 STOFLAG 30 CLX 31 SEEKPT 32 RDN 33 RTN 34 LBL 02 35 X<> L 36 ASTO L 37 CLA 38 FLSIZE 39 ARCL L 40 x<> L 41 RDN 42 4 43 ST+ L 44 X<> L 45 RESZFL 46 RDN 47 GTO 03 48 LBL "RCA" 49 STO L 50 CLX 51 SEEKPT 52 RDN 53 58 54 XTOA 55 RDN 56 POSFL 57 X<0? 58 GTO 01 59 GETREC 60 CLX 61 SEEKPT 62 RDN 63 RCLFLAG 64 X<> L 65 SF 28 66 SCI 9 67 ANUM 68 X<> L 69 STOFLAG 70 X<> L 71 RTN 72 LBL 01 73 X<> L 74 "^NOT FOUND" 75 AVIEW 76 BEEP 77 RTN 78 LBL "CLNVAR" compress named vars x-file to minimal neccessary of bytes 79 CLA 80 X<> L 81 RDN 82 FLSIZE 83 VIEW X 84 LBL 06 85 CLX 86 SEEKPT 87 "0E" 88 RDN 89 POSFL 90 X<0? 91 GTO 07 92 VIEW X 93 ST/ X 94 DELCHR 95 GTO 06 96 LBL 07 97 RDN 98 CLA 99 FLSIZE 100 SF 25 101 LBL 08 102 VIEW X 103 DSE X 104 RESZFL 105 FS? 25 106 GTO 08 107 CLX 108 SEEKPT 109 x<> L 110 BEEP 111 END Hope it can help someone! Best wishes from Brazil Artur ARTUR MARIO JUNIOR BRAZIL |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)