commit e312964
Devine Lu Linvega
·
2026-05-15 23:41:23 +0000 UTC
parent afacbf7
Updated perifs
1 files changed,
+198,
-33
+198,
-33
1@@ -20,19 +20,12 @@
2 #0f0f .System/r DEO2
3 #00ff .System/g DEO2
4 #00ff .System/b DEO2
5- ( | Draw mono dot )
6- ;dot-icn .Screen/addr DEO2
7- [ LIT2 01 -Screen/auto ] DEO
8- .Screen/width DEI2 #0020 SUB2 .Screen/x DEO2
9- .Screen/height DEI2 #0010 SUB2 .Screen/y DEO2
10- [ LIT2 41 -Screen/sprite ] DEO
11- [ LIT2 42 -Screen/sprite ] DEO
12- [ LIT2 43 -Screen/sprite ] DEO
13 ( | find center )
14 .Screen/width DEI2 #01 SFT2 .center/x STZ2
15 .Screen/height DEI2 #01 SFT2 .center/y STZ2
16 controller/<draw>
17 mouse/<draw>
18+ smile/<draw-all>
19 ;controller/on-event .Controller/vector DEO2
20 ;mouse/on-event .Mouse/vector DEO2
21 BRK
22@@ -42,13 +35,29 @@
23 ( author ) "By 20 "Hundred 20 "Rabbits 0a
24 ( date ) "30 20 "Apr 20 "2026 00 00
25
26+%Screen/<mod-x> ( x* -- ) {
27+ .Screen/x DEI2 ADD2 .Screen/x DEO2 }
28+
29+%Screen/<mod-y> ( x* -- ) {
30+ .Screen/y DEI2 ADD2 .Screen/y DEO2 }
31+
32+%Screen/<mod> ( x* y* -- ) {
33+ Screen/<mod-y>
34+ Screen/<mod-x> }
35+
36+%u8/mod ( a b -- res ) {
37+ DIVk MUL SUB }
38+
39 (
40 @|Controller )
41
42 @controller/on-event ( -> )
43 /<draw>
44 ( | print stack on start button )
45- [ LIT2 08 -Controller/button ] DEI NEQ ?{ #010e DEO }
46+ [ LIT2 08 -Controller/button ] DEI
47+ ( | handlers )
48+ DUP ?{ smile/<next> }
49+ NEQ ?{ #010e DEO }
50 BRK
51
52 @controller/<draw> ( -- )
53@@ -58,8 +67,7 @@
54 .center/y LDZ2 #0040 SUB2 .Screen/y DEO2
55 #03f9 ;&icns #f6 <draw-times>
56 ( | output )
57- .Screen/x DEI2 #0010 ADD2 .Screen/x DEO2
58- .Screen/y DEI2 #0050 SUB2 .Screen/y DEO2
59+ #0010 #ffb0 Screen/<mod>
60 DUP2 hex/<draw-short>
61 ( | A button )
62 OVR #01 AND #00 EQU ?{
63@@ -107,7 +115,10 @@
64 @|Mouse )
65
66 @mouse/on-event ( -> )
67- /<draw>
68+ [ LIT2 &last $1 -Mouse/state ] DEI DUP ,&last STR
69+ EQUk ?{
70+ DUP #00 EQU ?{ smile/<next> } }
71+ POP2 /<draw>
72 /<draw-cursor>
73 BRK
74
75@@ -129,15 +140,14 @@
76 .center/y LDZ2 #0020 ADD2 .Screen/y DEO2
77 #03fc ;&icns #f6 <draw-times>
78 ( | output )
79- .Screen/x DEI2 #0010 ADD2 .Screen/x DEO2
80- .Screen/y DEI2 #0030 SUB2 .Screen/y DEO2
81+ #0010 #ffd0 Screen/<mod>
82 [ LIT2 01 -Screen/auto ] DEO
83 .Mouse/state DEI DUP hex/<draw-byte>
84 ( | x )
85- .Screen/x DEI2 #0018 ADD2 .Screen/x DEO2
86+ #0018 Screen/<mod-x>
87 .Mouse/x DEI2 hex/<draw-short>
88 ( | y )
89- .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
90+ #0008 Screen/<mod-x>
91 .Mouse/y DEI2 hex/<draw-short>
92 ( | mouse 1 )
93 DUP #01 AND #00 EQU ?{
94@@ -165,7 +175,7 @@
95 .center/x LDZ2 #0048 ADD2 .Screen/x DEO2
96 .center/y LDZ2 #0020 ADD2 .Screen/y DEO2
97 #03ff ;&icns #16 <draw-times>
98- #03ff ;&icns #0010 ADD2 #16 <draw-times>
99+ #03ff ;&icns2 #16 <draw-times>
100 .&y LDZ2k .Mouse/scrolly DEI2 ADD2 ROT STZ2
101 .&y LDZ2 DUP2 #0010 ADD2 /offset
102 ( >> )
103@@ -178,6 +188,135 @@
104 &load ( offset* base* -- coord* )
105 SWP2 ;&offsets ADD2 LDA #00 SWP ADD2 JMP2r
106
107+(
108+@|Smile )
109+
110+@smile/<next> ( -- )
111+ [ LIT &ptr $1 ] INCk ,&ptr STR
112+ [ LIT2 00 -Screen/auto ] DEO
113+ #09 u8/mod
114+ ( | draw )
115+ #0020 .Screen/x DEO2
116+ .Screen/height DEI2 #0018 SUB2 .Screen/y DEO2
117+ DUP hex/<draw-byte>
118+ #00 SWP DUP ADD ;&lut ADD2 LDA2 JMP2
119+
120+@smile/<draw-all> ( -- )
121+ ;&lut-end ;&lut
122+ &>l
123+ LDA2k JSR2 INC2 INC2 GTH2k ?&>l
124+ POP2 POP2 JMP2r
125+
126+@smile/<set-pos> ( -- )
127+ #0010 .Screen/x DEO2
128+ .Screen/height DEI2 #0020 SUB2 .Screen/y DEO2
129+ JMP2r
130+
131+@smile/<draw-a> ( Draw 1bpp four times by moving x,y )
132+ /<set-pos>
133+ [ LIT2 00 -Screen/auto ] DEO
134+ ( a ) ;&hor-a .Screen/addr DEO2
135+ #03 .Screen/sprite DEO
136+ #0008 Screen/<mod-x>
137+ ( b ) ;&hor-b .Screen/addr DEO2
138+ #03 .Screen/sprite DEO
139+ #fff8 #0008 Screen/<mod>
140+ ( c ) ;&hor-c .Screen/addr DEO2
141+ #03 .Screen/sprite DEO
142+ #0008 #0000 Screen/<mod>
143+ ( d ) ;&hor-d .Screen/addr DEO2
144+ #03 .Screen/sprite DEO
145+ JMP2r
146+
147+@smile/<draw-b> ( Draw 1bpp two times using addr-y )
148+ /<set-pos>
149+ [ LIT2 16 -Screen/auto ] DEO
150+ ;&hor .Screen/addr DEO2
151+ #03 .Screen/sprite DEOk DEO
152+ JMP2r
153+
154+@smile/<draw-c> ( Draw 1bpp two times using addr-x )
155+ /<set-pos>
156+ [ LIT2 15 -Screen/auto ] DEO
157+ ;&ver .Screen/addr DEO2
158+ #03 .Screen/sprite DEOk DEO
159+ JMP2r
160+
161+@smile/<draw-d> ( Draw 1bpp-flipx two times using addr-y )
162+ /<set-pos>
163+ #0008 #0000 Screen/<mod>
164+ [ LIT2 16 -Screen/auto ] DEO
165+ ;&horx .Screen/addr DEO2
166+ #13 .Screen/sprite DEOk DEO
167+ JMP2r
168+
169+@smile/<draw-e> ( Draw 1bpp-flipy two times using addr-x )
170+ /<set-pos>
171+ #0000 #0008 Screen/<mod>
172+ [ LIT2 15 -Screen/auto ] DEO
173+ ;&very .Screen/addr DEO2
174+ #23 .Screen/sprite DEOk DEO
175+ JMP2r
176+
177+@smile/<draw-f> ( Draw 2bpp two times using addr-x )
178+ /<set-pos>
179+ [ LIT2 15 -Screen/auto ] DEO
180+ ;&2bpp .Screen/addr DEO2
181+ #81 .Screen/sprite DEOk DEO
182+ JMP2r
183+
184+@smile/<draw-g> ( Draw 1bpp, once for the outline, once for the face )
185+ /<set-pos>
186+ [ LIT2 16 -Screen/auto ] DEO
187+ ;&outline .Screen/addr DEO2
188+ #03 .Screen/sprite DEOk DEO
189+ #0000 #fff0 Screen/<mod>
190+ ;&face .Screen/addr DEO2
191+ #0f .Screen/sprite DEOk DEO
192+ JMP2r
193+
194+@smile/<draw-h> ( Draw 1bpp, once for the outline, once for the face in fg )
195+ /<set-pos>
196+ [ LIT2 16 -Screen/auto ] DEO
197+ ;&outline .Screen/addr DEO2
198+ #03 .Screen/sprite DEOk DEO
199+ #0000 #fff0 Screen/<mod>
200+ ;&face .Screen/addr DEO2
201+ #43 .Screen/sprite DEOk DEO
202+ JMP2r
203+
204+@smile/<draw-i> ( Draw using pixels )
205+ /<set-pos>
206+ ;&hor-a icn/<draw-tile>
207+ #0008 #fff8 Screen/<mod>
208+ ;&hor-b icn/<draw-tile>
209+ #fff8 #0000 Screen/<mod>
210+ ;&hor-c icn/<draw-tile>
211+ #0008 #fff8 Screen/<mod>
212+ ;&hor-d !icn/<draw-tile>
213+
214+@smile/lut [
215+ =/<draw-a> =/<draw-b> =/<draw-c> =/<draw-d>
216+ =/<draw-e> =/<draw-f> =/<draw-g> =/<draw-h>
217+ =/<draw-i> ] &lut-end
218+
219+@icn/<draw-tile> ( addr* -- )
220+ [ LIT2 01 -Screen/auto ] DEO
221+ DUP2 #0008 ADD2 SWP2
222+ &>v
223+ LDAk /<draw-row>
224+ #fff8 #0001 Screen/<mod>
225+ INC2 GTH2k ?&>v
226+ POP2 POP2 JMP2r
227+
228+@icn/<draw-row> ( byte -- )
229+ STH
230+ #ff07
231+ &>h
232+ STHkr OVR SFT #01 AND #03 MUL .Screen/pixel DEO
233+ #01 SUB NEQk ?&>h
234+ POP2 POPr JMP2r
235+
236 (
237 @|Generics )
238
239@@ -208,15 +347,19 @@
240 (
241 @|Assets )
242
243-@dot-icn [ 0000 183c 3c18 0000 ]
244+@wheel/offsets [
245+ 07 08 09 0a 0b 0b 0c 0c 0c 0c 0c 0b 0b 0a 09 08
246+ 07 06 05 04 03 03 02 02 02 02 02 03 03 04 05 06 ]
247+ &icns [ 0718 2040 4080 8081 c030 0804 0402 0202 ]
248+ &icns2 [ 8080 4040 2018 0700 0202 0404 0830 c000 ]
249
250-@large/icns [
251- 071f 3f7f 7fff ffff e0f8 fcfe feff ffff
252- ffff ff7f 7f3f 1f07 ffff fffe fefc f8e0 ]
253+@arrow/icn [ 187e 7eff ff7e 7e18 ]
254
255 @small/icn [ 0000 001f 3f3f 3f1f 0000 00f8 fcfc fcf8 ]
256
257-@arrow/icn [ 187e 7eff ff7e 7e18 ]
258+@large/icns [
259+ 071f 3f7f 7fff ffff e0f8 fcfe feff ffff
260+ ffff ff7f 7f3f 1f07 ffff fffe fefc f8e0 ]
261
262 @controller/icns [
263 0000 0f30 4040 8080 0000 ff00 0000 0000
264@@ -276,10 +419,6 @@
265 0000 0000 0000 00ff 0000 0000 0000 00ff
266 0000 0000 0000 00ff 0101 0101 0202 0cf0 ]
267
268-@mouse/tip-icn [ 0000 0000 187c 1800 $8 ]
269-
270-@mouse/cursor-icn [ 1010 10ee 1010 1000 ]
271-
272 @mouse/icns [
273 0000 0001 0618 6482 0718 6080 0000 0000
274 e01f 0000 0000 0000 00c0 3f00 001f 2020
275@@ -313,6 +452,8 @@
276 0000 0000 0000 0000 0000 0000 0000 0000
277 0000 0000 0000 0000 0000 0000 0000 0000
278 0000 0000 0000 0000 0000 0000 0000 0000 ]
279+ &tip-icn [ 0000 0000 187c 1800 $8 ]
280+ &cursor-icn [ 1010 10ee 1010 1000 ]
281
282 @hex/icns [
283 0018 2424 2424 2418 0008 1808 0808 0808
284@@ -324,11 +465,35 @@
285 0018 2420 2020 2418 0038 2424 2424 2438
286 001c 2020 3820 201c 001c 2020 3820 2020 ]
287
288-@wheel/icns [
289- 0718 2040 4080 8081 c030 0804 0402 0202
290- 8080 4040 2018 0700 0202 0404 0830 c000 ]
291-
292-@wheel/offsets [
293- 07 08 09 0a 0b 0b 0c 0c 0c 0c 0c 0b 0b 0a 09 08
294- 07 06 05 04 03 03 02 02 02 02 02 03 03 04 05 06 ]
295+@smile/hor
296+ &hor-a [ 030c 1020 4040 889c ]
297+ &hor-b [ c030 0804 0202 1129 ]
298+ &hor-c [ 8880 4443 2010 0c03 ]
299+ &hor-d [ 1101 22c2 0408 30c0 ]
300+
301+@smile/horx [
302+ 030c 1020 4040 8894 c030 0804 0202 1139
303+ 8880 4443 2010 0c03 1101 22c2 0408 30c0 ]
304+
305+@smile/very [
306+ 030c 1020 4344 8088 9c88 4040 2010 0c03
307+ c030 0804 c222 0111 2911 0202 0408 30c0 ]
308+
309+@smile/ver [
310+ 030c 1020 4040 889c 8880 4443 2010 0c03
311+ c030 0804 0202 1129 1101 22c2 0408 30c0 ]
312+
313+@smile/2bpp [
314+ 030c 1020 4040 889c 030c 1020 4040 889c
315+ 8880 4443 2010 0c03 8880 4443 2010 0c03
316+ c030 0804 0202 1129 c030 0804 0202 1129
317+ 1101 22c2 0408 30c0 1101 22c2 0408 30c0 ]
318+
319+@smile/outline [
320+ 030c 1020 4040 8080 c030 0804 0202 0101
321+ 8080 4040 2010 0c03 0101 0202 0408 30c0 ]
322+
323+@smile/face [
324+ 0000 0000 0000 081c 0000 0000 0000 1028
325+ 0800 0403 0000 0000 1000 20c0 0000 0000 ]
326