User Flag Catalog

Contributions to this software library are always welcome. Please ensure that you post program listings rather than .raw files. They give a reasonable idea of what your program does without having to load them into a DM42 and you can also include comments in your code. Check out the following link for a decoder/encoder: http://www.swissmicros.com/dm42/decoder/

You can then copy/paste the listing and post it in "code" tags.
Post Reply
Epidiah
Posts: 21
Joined: Mon Jan 29, 2018 2:08 am

User Flag Catalog

Post by Epidiah » Wed Oct 30, 2019 6:00 pm

Lately I've been finding myself creating states for my calculator that serve specific purposes. Sometimes this includes suites of programs that work together sharing variables and user flags. Here's a program I whipped up to help me keep notes on what some of the user flags mean to the programs I have in the current state.

Before you run the program, you need a 30x4 matrix stored in the variable UFLG. The first column should contain 0 through 10 and 81 through 99. This is an index for the user flags. The rest of the matrix can be 0s when you start.

How It Works
When you run UFLG it'll display a flag number followed by a ":" and then a note up to 18 characters long that you've supplied about that flag's purpose. Here's a Free42 screen capture to give you an idea:
Image
  • The up and down arrows scroll through the list of flags.
  • Key 1 toggles the set/clear state of the current flag. If a square appears before the flag number, it means the flag is currently set.
  • Key 6 opens the alpha register so you can add or change the note for the current flag. To fit on a single line (and in the 30x4 UFLG matrix) your note cannot be longer than 18 characters. It is possible that if you add 5 more columns to your UFLG matrix you'll be able to use both lines of the alpha register, but I've not tested that yet.
  • Exit key ends the program and returns both the stack and the alpha register back to the state it was in before you ran UFLG.
The program also uses the new Flag 64 feature to see if you hit shift before keys 1 and 6.
  • Shift key 1 clears all user flags.
  • Shift key 6 clears your note for the current flag.
Finally, you can go directly to a flag by keying in the number and hitting R/S. If a real number is in ST X when you first run the program, and that flag exists, it'll open at that flag.

Here's the program!

Code: Select all

00 { 317-Byte Prgm }
01▸LBL "UFLG"
02 LSTO "UFX"
03 R↓
04 LSTO "UFY"
05 R↓
06 LSTO "UFZ"
07 R↓
08 LSTO "UFT"
09 R↓
10 LASTX
11 LSTO "UFL"
12 1
13 8
14 NEWMAT
15 LSTO "UFA"
16 INDEX "UFA"
17 XEQ a
18 INDEX "UFLG"
19 RCL "UFX"
20▸LBL 00
21 REAL?
22 [FIND]
23▸LBL 01
24 CLMENU
25 10
26 RCLEL
27 "CF"
28 FC? IND ST X
29 "SF"
30 KEY 1 GTO 11
31 "NOTE"
32 KEY 6 GTO 16
33 KEY 7 GTO 17
34 KEY 8 GTO 18
35 KEY 9 GTO 19
36 MENU
37 " "
38 FS? IND ST X
39 "•"
40 X<Y?
41 ├"0"
42 AIP
43 ├":"
44 J+
45 XEQ A
46 AVIEW
47 STOP
48 GTO 00
49▸LBL 11
50 FS? 64
51 GTO 12
52 RCLEL
53 FC?C IND ST X
54 SF IND ST X
55 GTO 01
56▸LBL 12
57 0.01
58▸LBL 13
59 CF IND ST X
60 ISG ST X
61 GTO 13
62 81.099
63▸LBL 14
64 CF IND ST X
65 ISG ST X
66 GTO 14
67 GTO 01
68▸LBL 16
69 CLA
70 FS? 64
71 GTO 15
72 J+
73 XEQ A
74 AON
75 STOP
76 AOFF
77▸LBL 15
78 J+
79 XEQ a
80 GTO 01
81▸LBL 17
82 I-
83 FS? 76
84 XEQ 20
85 GTO 01
86▸LBL 18
87 I+
88 FS? 76
89 XEQ 20
90 GTO 01
91▸LBL 20
92 RCLIJ
93 R↓
94 1
95 STOIJ
96 RTN
97▸LBL a
98 ASTO ST X
99 STOEL
100 ASHF
101 J+
102 FC? 76
103 GTO a
104 I-
105 XEQ 20
106 RTN
107▸LBL A
108 RCLEL
109 STR?
110 ARCL ST X
111 J+
112 FC? 76
113 GTO A
114 I-
115 XEQ 20
116 RTN
117▸LBL 19
118 INDEX "UFA"
119 XEQ A
120 RCL "UFL"
121 STO ST L
122 RCL "UFT"
123 RCL "UFZ"
124 RCL "UFY"
125 RCL "UFX"
126 END
EDITED TO ADD: I previously had a second version of the program here because I had completely missed the fact that DM42 had the LSTO function.
Last edited by Epidiah on Wed Oct 30, 2019 6:41 pm, edited 1 time in total.

rprosperi
Posts: 501
Joined: Mon Apr 24, 2017 5:48 pm
Location: New York

Re: User Flag Catalog

Post by rprosperi » Wed Oct 30, 2019 6:31 pm

Epidiah wrote:
Wed Oct 30, 2019 6:00 pm
Here's a program I whipped up to help me keep notes on what some of the user flags mean to the programs I have in the current state.
[snip]

Here's the program using LSTO command that the current version of Free42 has and hopefully the DM42 will have soon. A version compatible with the current DM42 follows this one.
Clever and useful program, thanks for sharing it. Most creative use for a matrix that I've seen in a long time...

DM42 has supported Local Variables (LSTO) since Ver 3.14 in July (based on Free42 v2.2). Is there some later enhancement to Free42 you are using? If not, it should work the same as on Free42, assuming you've installed 3.14 onto your DM42.
--bob p

DM42: β00071 & 00282

Epidiah
Posts: 21
Joined: Mon Jan 29, 2018 2:08 am

Re: User Flag Catalog

Post by Epidiah » Wed Oct 30, 2019 6:38 pm

rprosperi wrote:
Wed Oct 30, 2019 6:31 pm
DM42 has supported Local Variables (LSTO) since Ver 3.14 in July (based on Free42 v2.2). Is there some later enhancement to Free42 you are using? If not, it should work the same as on Free42, assuming you've installed 3.14 onto your DM42.
You're absolutely right! I got a bit mixed up about about which features were where. And here I was, painstakingly rewriting programs from my phone to my DM42 when I didn't have to.

Epidiah
Posts: 21
Joined: Mon Jan 29, 2018 2:08 am

Re: User Flag Catalog

Post by Epidiah » Wed Oct 30, 2019 7:06 pm

After plugging all this into the forum, I realized it would be easy to make the program slightly more user friendly by having it generate an empty UFLAG matrix if there doesn't happen to be one. That way you can just load the program into a new state without having to go through the trouble of making one by hand.

Code: Select all

00 { 382-Byte Prgm }
01▸LBL "UFLG"
02 LSTO "UFX"
03 R↓
04 LSTO "UFY"
05 R↓
06 LSTO "UFZ"
07 R↓
08 LSTO "UFT"
09 R↓
10 LASTX
11 LSTO "UFL"
12 1
13 8
14 NEWMAT
15 LSTO "UFA"
16 INDEX "UFA"
17 XEQ a
18 SF 25
19 INDEX "UFLG"
20 FC?C 25
21 XEQ 25
22 RCL "UFX"
23▸LBL 00
24 REAL?
25 [FIND]
26▸LBL 01
27 CLMENU
28 10
29 RCLEL
30 "CF"
31 FC? IND ST X
32 "SF"
33 KEY 1 GTO 11
34 "NOTE"
35 KEY 6 GTO 16
36 KEY 7 GTO 17
37 KEY 8 GTO 18
38 KEY 9 GTO 19
39 MENU
40 " "
41 FS? IND ST X
42 "•"
43 X<Y?
44 ├"0"
45 AIP
46 ├":"
47 J+
48 XEQ A
49 AVIEW
50 STOP
51 GTO 00
52▸LBL 11
53 FS? 64
54 GTO 12
55 RCLEL
56 FC?C IND ST X
57 SF IND ST X
58 GTO 01
59▸LBL 12
60 0.01
61▸LBL 13
62 CF IND ST X
63 ISG ST X
64 GTO 13
65 81.099
66▸LBL 14
67 CF IND ST X
68 ISG ST X
69 GTO 14
70 GTO 01
71▸LBL 16
72 CLA
73 FS? 64
74 GTO 15
75 J+
76 XEQ A
77 AON
78 STOP
79 AOFF
80▸LBL 15
81 J+
82 XEQ a
83 GTO 01
84▸LBL 17
85 I-
86 FS? 76
87 XEQ 20
88 GTO 01
89▸LBL 18
90 I+
91 FS? 76
92 XEQ 20
93 GTO 01
94▸LBL 20
95 RCLIJ
96 R↓
97 1
98 STOIJ
99 RTN
100▸LBL a
101 ASTO ST X
102 STOEL
103 ASHF
104 J+
105 FC? 76
106 GTO a
107 I-
108 XEQ 20
109 RTN
110▸LBL A
111 RCLEL
112 STR?
113 ARCL ST X
114 J+
115 FC? 76
116 GTO A
117 I-
118 XEQ 20
119 RTN
120▸LBL 19
121 INDEX "UFA"
122 XEQ A
123 RCL "UFL"
124 STO ST L
125 RCL "UFT"
126 RCL "UFZ"
127 RCL "UFY"
128 RCL "UFX"
129 RTN
130▸LBL 25
131 STOP
132 30
133 4
134 NEWMAT
135 EDIT
136 0.01
137 XEQ 26
138 81.099
139 XEQ 26
140 EXITALL
141 IP
142 STO "UFLG"
143 INDEX "UFLG"
144 RTN
145▸LBL 26
146 ENTER
147 ↓
148 R↓
149 ISG ST X
150 GTO 26
151 END

whuyse
Posts: 42
Joined: Thu Dec 21, 2017 12:23 pm

Re: User Flag Catalog

Post by whuyse » Sun Nov 10, 2019 9:52 pm

in Free42 (and the DM42) you can store up to 14 characters per register instead of only 6,
using the following utilities to transform up to 14 characters to the X register (A2X) and its inverse (X2A)

Code: Select all

00 { 77-Byte Prgm }
01>LBL "A2X"
02 ALENG
03 14
04 X>Y? 
05 X<>Y
06 25600
07 0
08>LBL 03
09 %
10 ATOX
11 +
12 DSE ST Z
13 GTO 03
14 RTN
15>LBL "X2A"
16 ENTER
17 LN
18 256
19 LN
20 /
21 IP
22 256
23 X<>Y
24 Y^X
25>LBL 02
26 RCL ST Y
27 X<>Y
28 MOD
29 STO- ST Y
30 X<>Y
31 LASTX
32 /
33 XTOA
34 Rv
35 LASTX
36 256
37 /
38 IP
39 X>0?
40 GTO 02
41 END
Cheers, Werner
42S #3249S01123
DM42 #00345

Post Reply