Browse code

(label.tal) Rewrote with the screen/auto support

neauoire authored on 18/03/2022 18:02:27
Showing 1 changed files
... ...
@@ -1,60 +1,23 @@
1 1
 ( GUI Labels )
2 2
 
3
-%+  { ADD }  %-  { SUB }  %*  { MUL }  %/  { DIV }
4
-%<  { LTH }  %>  { GTH }  %=  { EQU }  %!  { NEQ }
5
-%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
6
-%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
7
-
8
-%=~ { EQUk NIP } %!~ { NEQk NIP }
9
-%<~ { LTHk NIP } %>~ { GTHk NIP }
10
-
11
-%2*  { #10 SFT } %2/  { #01 SFT } %2**  { #10 SFT2 } %2//  { #01 SFT2 }
12
-%4*  { #20 SFT } %4/  { #02 SFT } %4**  { #20 SFT2 } %4//  { #02 SFT2 }
13
-%8*  { #30 SFT } %8/  { #03 SFT } %8**  { #30 SFT2 } %8//  { #03 SFT2 }
14
-%10* { #40 SFT } %10/ { #04 SFT } %10** { #40 SFT2 } %10// { #04 SFT2 }
15
-%20* { #50 SFT } %20/ { #05 SFT } %20** { #50 SFT2 } %20// { #05 SFT2 }
16
-
17
-%IS-VALID { DUP #1f > SWP #7f < AND }
18
-
19
-%RTN { JMP2r }
20
-%TOS { #00 SWP }
21
-%AUTO-NONE   { #00 .Screen/auto DEO }
22
-%AUTO-Y      { #02 .Screen/auto DEO }
23
-%AUTO-YADDR  { #06 .Screen/auto DEO }
24
-
25
-%HALT   { #010f DEO }
26
-%EMIT   { #18 DEO }
27
-%PRINT  { ;print-str JSR2 #0a EMIT }
28
-%DEBUG  { ;print-hex/byte JSR2 #0a EMIT }
29
-%DEBUG2 { ;print-hex JSR2 #0a EMIT }
30
-
31
-( devices )
32
-
33
-|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
34
-|20 @Screen     &vector $2 &width    $2 &height $2 &auto   $1 &pad    $1 &x       $2 &y       $2 &addr   $2 &pixel $1 &sprite $1
35
-
36
-( variables )
3
+|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
4
+|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
37 5
 
38 6
 |0000
39 7
 
40
-@label [ &x $2 &y $2 &color $1 &addr $2 ]
41
-@center [ &x $2 &y $2 ]
42
-
43
-( program )
8
+@center &x $2 &y $2
44 9
 
45 10
 |0100
46 11
 	
47
-	( theme ) 
48
-	#f0d7 .System/r DEO2 
49
-	#f0de .System/g DEO2 
12
+	( theme )
13
+	#f0d7 .System/r DEO2
14
+	#f0de .System/g DEO2
50 15
 	#f0dc .System/b DEO2
51
-	
52 16
 	( find screen center )
53
-	.Screen/width DEI2 2// .center/x STZ2
54
-	.Screen/height DEI2 2// .center/y STZ2
55
-
17
+	.Screen/width DEI2 #01 SFT2 .center/x STZ2
18
+	.Screen/height DEI2 #01 SFT2 .center/y STZ2
56 19
 	( ver )
57
-	AUTO-Y
20
+	#02 .Screen/auto DEO
58 21
 	#0000 .Screen/y DEO2
59 22
 	.center/x LDZ2 .Screen/x DEO2
60 23
 	.Screen/height DEI2 #0000
... ...
@@ -63,17 +26,17 @@
63 26
 		.Screen/y DEI2k INC2 ROT DEO2
64 27
 		INC2 GTH2k ,&ver JCN
65 28
 	POP2 POP2
66
-
29
+	( left )
67 30
 	.center/x LDZ2 .Screen/x DEO2
68
-	.center/y LDZ2 #0020 -- .Screen/y DEO2
31
+	.center/y LDZ2 #0020 SUB2 .Screen/y DEO2
69 32
 	;left-txt #09 ;draw-uf2 JSR2
70
-
33
+	( center )
71 34
 	.center/x LDZ2 .Screen/x DEO2
72 35
 	.center/y LDZ2 .Screen/y DEO2
73 36
 	;center-txt #09 ;draw-uf2-center JSR2
74
-
37
+	( right )
75 38
 	.center/x LDZ2 .Screen/x DEO2
76
-	.center/y LDZ2 #0020 ++ .Screen/y DEO2
39
+	.center/y LDZ2 #0020 ADD2 .Screen/y DEO2
77 40
 	;right-txt #09 ;draw-uf2-right JSR2
78 41
 
79 42
 BRK
... ...
@@ -81,87 +44,43 @@ BRK
81 44
 @draw-uf2-center ( text* color -- )
82 45
 	
83 46
 	STH
84
-	DUP2 ,get-width JSR 2// .Screen/x DEI2 SWP2 -- .Screen/x DEO2
47
+	DUP2 ,get-width JSR #01 SFT2 STH2 .Screen/x DEI2k STH2r SUB2 ROT DEO2
85 48
 	STHr ,draw-uf2 JSR
86 49
 
87
-RTN
50
+JMP2r
88 51
 
89 52
 @draw-uf2-right ( text* color -- )
90 53
 
91 54
 	STH
92
-	DUP2 ,get-width JSR .Screen/x DEI2 SWP2 -- .Screen/x DEO2
55
+	DUP2 ,get-width JSR STH2 .Screen/x DEI2k STH2r SUB2 ROT DEO2
93 56
 	STHr ,draw-uf2 JSR
94 57
 
95
-RTN
58
+JMP2r
96 59
 
97 60
 @get-width ( text* -- width* )
98 61
 
99 62
 	LIT2r 0000
100 63
 	&while
101
-		LDAk TOS ;font ++ LDA TOS STH2 ADD2r
64
+		LDAk #0000 ROT ;font ADD2 LDA STH2 ADD2r
102 65
 		INC2 LDAk ,&while JCN
103 66
 	POP2
104 67
 	STH2r
105 68
 
106
-RTN
69
+JMP2r
107 70
 
108 71
 @draw-uf2 ( text* color -- )
109 72
 
110 73
 	STH
111
-	AUTO-YADDR
74
+	#15 .Screen/auto DEO
112 75
 	&while
113
-		LDAk STHkr ,draw-glyph JSR
76
+		LDAk STHkr SWP
77
+		#00 SWP #20 SUB
78
+			( addr ) DUP2 #50 SFT2 ;font/glyphs ADD2 .Screen/addr DEO2
79
+			( anchor ) ;font ADD2 LDA #00 SWP .Screen/x DEI2 ADD2 STH2
80
+		.Screen/sprite DEOk DEO
81
+		STH2r .Screen/x DEO2
114 82
 		INC2 LDAk ,&while JCN
115 83
 	POP2 POPr
116
-	AUTO-NONE
117
-
118
-RTN
119
-
120
-@draw-glyph ( char color -- )
121
-
122
-	.Screen/x DEI2 STH2 
123
-	.Screen/y DEI2 STH2 
124
-	( glyph ) OVR ,get-glyph JSR .Screen/addr DEO2
125
-	DUP .Screen/sprite DEOk DEO 
126
-	STH2kr .Screen/y DEO2
127
-	( get width ) SWP TOS ;font ++ LDA 
128
-	DUP #09 < ,&narrow JCN
129
-		.Screen/x DEI2k #0008 ++ ROT DEO2
130
-		OVR .Screen/sprite DEOk DEO 
131
-		STH2kr .Screen/y DEO2
132
-		&narrow
133
-	POP2r
134
-	( width ) TOS STH2r ++ .Screen/x DEO2
135
-	POP
136
-
137
-RTN
138
-
139
-@get-glyph ( char -- addr* )
140
-
141
-	#09 =~ ,&tab JCN ( tab )
142
-	#0a =~ ,&linebreak JCN ( linebreak )
143
-	#0d =~ ,&linebreak JCN ( linebreak )
144
-	DUP IS-VALID ,&valid JCN
145
-		POP ;unknown-icn RTN
146
-	&linebreak
147
-		POP ;linebreak-icn RTN
148
-	&tab
149
-		POP ;tab-icn RTN
150
-	&valid
151
-	TOS 20** ;font
152
-	#0100 ++ ++
153
-
154
-RTN
155
-
156
-@print-hex ( value* -- )
157
-
158
-	SWP ,&byte JSR 
159
-	&byte ( byte -- )
160
-		STHk #04 SFT ,&parse JSR #18 DEO
161
-		STHr #0f AND ,&parse JSR #18 DEO
162
-	JMP2r
163
-	&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r 
164
-	&above #57 ADD JMP2r
165 84
 
166 85
 JMP2r
167 86
 
... ...
@@ -170,24 +89,22 @@ JMP2r
170 89
 @right-txt "Right 20 "Aligned 20 "Label $1
171 90
 
172 91
 @unknown-icn
173
-	aa55 aa55 aa55 aa55 
174 92
 	aa55 aa55 aa55 aa55
175
-	aa55 aa55 aa55 aa55 
93
+	aa55 aa55 aa55 aa55
94
+	aa55 aa55 aa55 aa55
176 95
 	aa55 aa55 aa55 aa55
177 96
 @tab-icn
178
-	0000 0000 0000 1008 
179
-	1000 0000 0000 0000 
97
+	0000 0000 0000 1008
98
+	1000 0000 0000 0000
180 99
 	0000 0000 0000 0000
181 100
 	0000 0000 0000 0000
182 101
 @linebreak-icn
183
-	0000 0000 0000 1028 
102
+	0000 0000 0000 1028
184 103
 	1000 0000 0000 0000
185 104
 	0000 0000 0000 0000
186 105
 	0000 0000 0000 0000
187 106
 
188 107
 @font ( venice14 )
189
-	0000 0000 0000 0000 0009 0000 0000 0000
190
-	0000 0000 0000 0000 0000 0000 0000 0000
191 108
 	0505 0809 080c 0d05 0707 0a09 0609 0608
192 109
 	0808 0808 0908 0808 0808 0505 0708 0709
193 110
 	000d 0a08 0b0a 090a 0c08 070c 090e 0c09
... ...
@@ -202,70 +119,7 @@ JMP2r
202 119
 	090c 0808 0505 0000 0907 0000 0000 0000
203 120
 	0000 0000 0000 0000 0000 0000 0000 0000
204 121
 	0000 0000 0000 0000 0000 0000 0000 0000
205
-	0000 0000 0000 0000 0000 0000 0000 0000
206
-	0000 0000 0000 0000 0000 0000 0000 0000
207
-	0000 0000 0000 0000 0000 0000 0000 0000
208
-	0000 0000 0000 0000 0000 0000 0000 0000
209
-	0000 0000 0000 0000 0000 0000 0000 0000
210
-	0000 0000 0000 0000 0000 0000 0000 0000
211
-	0000 0000 0000 0000 0000 0000 0000 0000
212
-	0000 0000 0000 0000 0000 0000 0000 0000
213
-	0000 0000 0000 0000 0000 0000 0000 0000
214
-	0000 0000 0000 0000 0000 0000 0000 0000
215
-	0000 0000 0000 0000 0000 0000 0000 0000
216
-	0000 0000 0000 0000 0000 0000 0000 0000
217
-	0000 0000 0000 0000 0000 0000 0000 0000
218
-	0000 0000 0000 0000 0000 0000 0000 0000
219
-	0000 0000 0000 0000 0000 0000 0000 0000
220
-	0000 0000 0000 0000 0000 0000 0000 0000
221
-	0000 0000 0000 0000 0000 0000 0000 0000
222
-	0000 0000 0000 0000 0000 0000 0000 0000
223
-	0000 0000 0000 0000 0000 0000 0000 0000
224
-	0000 0000 0000 0000 0000 0000 0000 0000
225
-	0000 0000 0000 0000 0000 0000 0000 0000
226
-	0000 0000 0000 0000 0000 0000 0000 0000
227
-	0000 0000 0000 0000 0000 0000 0000 0000
228
-	0000 0000 0000 0000 0000 0000 0000 0000
229
-	0000 0000 0000 0000 0000 0000 0000 0000
230
-	0000 0000 0000 0000 0000 0000 0000 0000
231
-	0000 0000 0000 0000 0000 0000 0000 0000
232
-	0000 0000 0000 0000 0000 0000 0000 0000
233
-	0000 0000 0000 0000 0000 0000 0000 0000
234
-	0000 0000 0000 0000 0000 0000 0000 0000
235
-	0000 0000 0000 0000 0000 0000 0000 0000
236
-	0000 0000 0000 0000 0000 0000 0000 0000
237
-	0000 0000 0000 0000 0000 0000 0000 0000
238
-	0000 0000 0000 0000 0000 0000 0000 0000
239
-	0000 0000 0000 0000 0000 0000 0000 0000
240
-	0000 0000 0000 0000 0000 0000 0000 0000
241
-	0000 0000 0000 0000 0000 0000 0000 0000
242
-	0000 0000 0000 0000 0000 0000 0000 0000
243
-	0000 0000 0000 0000 0000 0000 0000 0000
244
-	0000 0000 0000 0000 0000 0000 0000 0000
245
-	0000 0000 0000 0000 0000 0000 0000 0000
246
-	0000 0000 0000 0000 0000 0000 0000 0000
247
-	0000 0000 0000 0000 0000 0000 0000 0000
248
-	0000 0000 0000 0000 0000 0000 0000 0000
249
-	0000 0000 0000 0000 0000 0000 0000 0000
250
-	0000 0000 0000 0000 0000 0000 0000 0000
251
-	0000 0000 0000 0000 0000 0000 0000 0000
252
-	0000 0000 0000 0000 0000 0000 0000 0000
253
-	0000 0000 0000 0000 0000 0000 0000 0000
254
-	0000 0000 0000 0000 0000 0000 0000 0000
255
-	0000 0000 0000 0000 0000 0000 0000 0000
256
-	0000 0000 0000 0000 0000 0000 0000 0000
257
-	0000 0000 0000 0000 0000 0000 0000 0000
258
-	0000 0000 0000 0000 0000 0000 0000 0000
259
-	0000 0000 0000 0000 0000 0000 0000 0000
260
-	0000 0000 0000 0000 0000 0000 0000 0000
261
-	0000 0000 0000 0000 0000 0000 0000 0000
262
-	0000 0000 0000 0000 0000 0000 0000 0000
263
-	0000 0000 0000 0000 0000 0000 0000 0000
264
-	0000 0000 0000 0000 0000 0000 0000 0000
265
-	0000 0000 0000 0000 0000 0000 0000 0000
266
-	0000 0000 0000 0000 0000 0000 0000 0000
267
-	0000 0000 0000 0000 0000 0000 0000 0000
268
-	0000 0000 0000 0000 0000 0000 0000 0000
122
+	&glyphs ( starting at #20 )
269 123
 	0000 0000 0000 0000 0000 0000 0000 0000
270 124
 	0000 0000 0000 0000 0000 0000 0000 0000
271 125
 	0000 3030 3030 3030 3000 3030 0000 0000