~rabbits/cccc

ref: 8af56207568a0bb932d942c8a2670a765b80157c cccc/src/cccc.tal -rw-r--r-- 27.0 KiB
8af56207neauoire Merge branch 'main' of git.sr.ht:~rabbits/cccc 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
( app/cccc : graphical calculator 52428 )

|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|10 @Console &vector $2 &read $1 &pad $5 &write $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2

|0000

	@mode
		&dec $1
		&dot $1
	@cursor
		&x $2 &y $2
		&d &dx $1 &dy $1
	@input 
		&num $2 &den $2
	@length $2

|0100

	( theme )
	#50f2 .System/r DEO2
	#b0f9 .System/g DEO2
	#a0f8 .System/b DEO2
	;load-theme JSR2

	( playdate size 0190 x 00f0  )
	#00e0 .Screen/width DEO2
	#00f0 .Screen/height DEO2

	( setup synth )
	#0003 .Audio0/adsr DEO2
	;tone .Audio0/addr DEO2
	#0100 .Audio0/length DEO2
	#ff .Audio0/volume DEO ( TODO: turn ON )

	#0001 .input/den STZ2

	( initial draw )
	;redraw JSR2

	( vectors )
	;on-console .Console/vector DEO2
	;on-button .Controller/vector DEO2
	;on-mouse .Mouse/vector DEO2
	;on-frame .Screen/vector DEO2

BRK

(
@|vectors )

@on-console ( -> )

	.Console/read DEI ;listen JSR2

BRK

@on-button ( -> )

	.Controller/button DEI2 #01 LIT "v NEQ2 ,&no-paste JCN
		;snarf-paste JSR2
		&no-paste

	.Controller/button DEI
	DUP #10 NEQ ,&no-u JCN
		.cursor/dx LDZ .cursor/dy LDZ #01 SUB ;set-sel JSR2
		&no-u
	DUP #20 NEQ ,&no-d JCN
		.cursor/dx LDZ .cursor/dy LDZ INC ;set-sel JSR2
		&no-d
	DUP #40 NEQ ,&no-l JCN
		.cursor/dx LDZ #01 SUB .cursor/dy LDZ ;set-sel JSR2
		&no-l
	DUP #80 NEQ ,&no-r JCN
		.cursor/dx LDZ INC .cursor/dy LDZ ;set-sel JSR2
		&no-r
	DUP #01 NEQ ,&no-a JCN
		;press-sel JSR2
		&no-a
	DUP #02 NEQ ,&no-b JCN
		;erase JSR2
		&no-b
	POP

	.Controller/key DEI ;listen JSR2

BRK

@on-frame ( -> )

	( delay )
	[ LIT &f 00 ] INCk ,&f STR #03 AND #00 EQU [ JMP BRK ]

	( find buttons )
	;buttons/end ;buttons
	&loop
		#0008 ADD2 LDAk #00 EQU ,&continue JCN
			( decr time )
			DUP2 LDAk #01 SUB ROT ROT STA
			( release button )
			LDAk ,&continue JCN
				DUP2 #0008 SUB2 #00 ;press-button/release JSR2
			&continue
		INC2 GTH2k ,&loop JCN
	POP2 POP2

BRK

@on-mouse ( -> )

	( clear last cursor )
	#40 ;draw-cursor JSR2

	( draw new cursor )
	.Mouse/x DEI2 .cursor/x STZ2
	.Mouse/y DEI2 .cursor/y STZ2
	;cursor-icn .Screen/addr DEO2
	#43 .Mouse/state DEI #00 NEQ DUP ADD SUB ;draw-cursor JSR2

	.Mouse/state DEI ,&on-mouse-touch JCN

BRK
	&on-mouse-touch ( -> )

	.Mouse/x DEI2 #0010 SUB2 #03 SFT2 NIP #03 DIV
	.Mouse/y DEI2 #0078 SUB2 #03 SFT2 NIP

	#00 .Mouse/state DEO

	OVR #07 GTH ,&skip JCN
	DUP #fd GTH ,on-touch-bitpad JCN
	DUP #0b GTH ,&skip JCN
	OVR #02 LTH ,on-touch-fncpad JCN
	OVR #06 LTH ,on-touch-numpad JCN
	OVR #08 LTH ,on-touch-modpad JCN
	&skip
	POP2

BRK

@on-touch-bitpad ( x y -- )

	POP2

	.Mouse/x DEI2 #0033 GTH2 ,&continue JCN
		BRK
		&continue

	#0001
	( shift )
	#000f
	.Mouse/x DEI2 #0038 SUB2 #03 SFT2
		DUP2 #0005 DIV2 SUB2 SUB2
	#40 SFT NIP
	( mask )
	SFT2 .input LDZ2 EOR2
		 .input STZ2
	;update-input JSR2

BRK

@on-touch-fncpad ( x/3 y -> )

	#01 SFT SWP #06 MUL ADD
	#00 SWP DUP ADD ;fncpad ADD2
		LDA2 JSR2

BRK

@on-touch-numpad ( x/3 y -> )

	SWP #02 SUB SWP
	#03 DIV #20 SFT ADD 
	#00 SWP DUP ADD ;numpad ADD2
		LDA2 JSR2

BRK

@on-touch-modpad ( x/3 y -> )

	#03 DIV SWP #06 SUB #20 SFT ADD
	#00 SWP DUP ADD ;modpad ADD2
		LDA2 JSR2

BRK

(
@|main )

@listen ( c -- )

	STHk
	#00 EQU ,&skip JCN

	;keys/end ;keys
	&loop
		LDAk STHkr NEQ ,&continue JCN
			INC2k LDA2 JSR2 ,&end JMP
			&continue
		INC2 INC2 INC2 GTH2k ,&loop JCN
	&end
	POP2 POP2
	&skip
	POPr

JMP2r

@eval ( -- )

	;buttons/push ;press-button JSR2
	.input LDZ2 #0001 ;push JSR2
	#0000 .input STZ2
	;update-input JSR2
	;draw-display ( .. )

JMP2

@append ( val -- )

	#00 SWP 
	.input LDZ2 
		#00 #0a10 .mode/dec LDZ [ JMP SWP POP ] MUL2 ADD2 
		.input STZ2
	;draw-input ( .. )

JMP2

@erase ( -- )

	( clamp )
	.input LDZ2 ORA ,&has-input JCN
		;buttons/pop ;press-button JSR2
		.length LDZ2 ORA #01 JCN JMP2r
		;pop JSR2 POP2 POP2
		;draw-display JMP2
		&has-input

	.input LDZ2 
		#00 #0a10 .mode/dec LDZ [ JMP SWP POP ] DIV2
		.input STZ2
	;update-input ( .. )

JMP2

@clear ( -- )

	;buttons/clr ;press-button JSR2
	#0000 .length STZ2
	#0000 .input STZ2
	;draw-display JSR2
	;update-input ( .. )

JMP2

@tog-mode ( -- )

	;buttons/mode ;press-button JSR2
	.mode/dec LDZk INC #01 AND SWP STZ
	.mode/dot LDZk .mode/dec LDZ #00 EQU ADD #01 AND SWP STZ
	;draw-display JSR2
	;draw-mode ( .. )

JMP2

@set-dec ( -- )

	#01 .mode/dec STZ
	;draw-display JSR2
	;draw-mode ( .. )

JMP2

@set-hex ( -- )

	#00 .mode/dec STZ
	;draw-display JSR2
	;draw-mode ( .. )

JMP2

@set-sel ( x y -- )

	( erase last sel )
	#00 ;draw-sel JSR2
	#40 ;draw-cursor JSR2

	( store new sel )
	#03 AND .cursor/dy STZ
	#07 AND .cursor/dx STZ

	( draw new sel )
	#81 ;draw-sel ( .. )

JMP2

@press-sel ( -- )

	#00 .cursor/d LDZ2 #30 SFT ADD #20 SFT2
		;layout ADD2 INC2 INC2 LDA2 ( .. )

JMP2

@gcd ( num* den* -- d* ) ORAk ,&ok JCN POP2 JMP2r &ok SWP2 OVR2 ( MOD2 ) [ DIV2k MUL2 SUB2 ] ,gcd JMP

@push ( num* den* -- )

	OVR2 #0000 EQU2 ,&invalid JCN
	ORAk #00 EQU ,&invalid JCN
	( reduce )
	OVR2 OVR2 ,gcd JSR STH2k DIV2 SWP2 STH2r DIV2
	( store )
	.length LDZ2 #20 SFT2 ;memory ADD2 STH2k STA2
	STH2r INC2 INC2 STA2
	.length LDZ2k INC2 ROT STZ2

JMP2r
	&invalid POP2 POP2 JMP2r

@pop ( -- num* den* )

	.length LDZ2 #01 SUB #20 SFT2 ;memory ADD2
	LDA2k SWP2 INC2 INC2 LDA2
	.length LDZ2k #0001 SUB2 ROT STZ2

JMP2r

(
@|operations )

@dup ( -- )

	;buttons/dup ;press-button JSR2
	;eval JSR2
	.length LDZ2 ORA #01 JCN JMP2r

	;pop JSR2 OVR2 OVR2 ;push JSR2 ;push JSR2
	;draw-display ( .. )

JMP2

@swp ( -- )

	;buttons/swp ;press-button JSR2
	;eval JSR2
	.length LDZ2 #0002 LTH2 ,&skip JCN

	;pop JSR2 ;pop JSR2 ROT2 STH2 ROT2 STH2r ;push JSR2 ;push JSR2
	;draw-display JSR2
	&skip

JMP2r

@vid ( -- )

	;buttons/vid ;press-button JSR2
	;eval JSR2
	.length LDZ2 ORA #01 JCN JMP2r
	.length LDZ2 #20 SFT2 #0002 SUB2 ;memory ADD2 LDA2 #0001 EQU2 ,&skip JCN

	;pop JSR2 SWP2 #0001 ;push JSR2
	#0001 ;push JSR2
	;draw-display JSR2
	&skip

JMP2r

@inv ( -- )

	;buttons/inv ;press-button JSR2
	;eval JSR2
	.length LDZ2 ORA #01 JCN JMP2r

	;pop JSR2 SWP2 ;push JSR2
	;draw-display ( .. )

JMP2

@add ( -- )

	;buttons/add ;press-button JSR2
	;eval JSR2
	.length LDZ2 #0002 LTH2 ,&skip JCN

	;pop JSR2 ,&bd STR2 ,&bn STR2
	;pop JSR2 ,&ad STR2 ,&an STR2
	[ LIT2 &an $2 ] [ LIT2 &bd $2 ] MUL2
	[ LIT2 &ad $2 ] [ LIT2 &bn $2 ] MUL2 ADD2
	,&ad LDR2 ,&bd LDR2 MUL2 ;push JSR2
	;draw-display JSR2
	&skip

JMP2r

@sub ( -- )

	;buttons/sub ;press-button JSR2
	;eval JSR2
	.length LDZ2 #0002 LTH2 ,&skip JCN

	;pop JSR2 ,&bd STR2 ,&bn STR2
	;pop JSR2 ,&ad STR2 ,&an STR2
	[ LIT2 &an $2 ] [ LIT2 &bd $2 ] MUL2
	[ LIT2 &ad $2 ] [ LIT2 &bn $2 ] MUL2 SUB2
	,&ad LDR2 ,&bd LDR2 MUL2 ;push JSR2
	;draw-display JSR2
	&skip

JMP2r

@mul ( -- )

	;buttons/mul ;press-button JSR2
	;eval JSR2
	.length LDZ2 #0002 LTH2 ,&skip JCN

	;pop JSR2 ,&bd STR2 ,&bn STR2
	;pop JSR2 ,&ad STR2 ,&an STR2
	[ LIT2 &an $2 ] [ LIT2 &bn $2 ] MUL2
	[ LIT2 &ad $2 ] [ LIT2 &bd $2 ] MUL2
		;push JSR2
	;draw-display JSR2
	&skip

JMP2r

@div ( -- )

	;buttons/div ;press-button JSR2
	;eval JSR2
	.length LDZ2 #0002 LTH2 ,&skip JCN

	;pop JSR2 ,&bd STR2 ,&bn STR2
	;pop JSR2 ,&ad STR2 ,&an STR2
	[ LIT2 &an $2 ] [ LIT2 &bd $2 ] MUL2
	[ LIT2 &ad $2 ] [ LIT2 &bn $2 ] MUL2
		;push JSR2
	;draw-display JSR2
	&skip

JMP2r

@and ( -- )

	;buttons/and ;press-button JSR2
	;eval JSR2
	.length LDZ2 #0002 LTH2 ,&skip JCN

	;pop JSR2 ,&bd STR2 ,&bn STR2
	;pop JSR2 ,&ad STR2 ,&an STR2
	[ LIT2 &an $2 ] [ LIT2 &bd $2 ] MUL2
	[ LIT2 &ad $2 ] [ LIT2 &bn $2 ] MUL2 AND2
	,&ad LDR2 ,&bd LDR2 MUL2 ;push JSR2
	;draw-display JSR2
	&skip

JMP2r

@ora ( -- )

	;buttons/ora ;press-button JSR2
	;eval JSR2
	.length LDZ2 #0002 LTH2 ,&skip JCN

	;pop JSR2 ,&bd STR2 ,&bn STR2
	;pop JSR2 ,&ad STR2 ,&an STR2
	[ LIT2 &an $2 ] [ LIT2 &bd $2 ] MUL2
	[ LIT2 &ad $2 ] [ LIT2 &bn $2 ] MUL2 ORA2
	,&ad LDR2 ,&bd LDR2 MUL2 ;push JSR2
	;draw-display JSR2
	&skip

JMP2r

@sfl ( -- )

	;buttons/sfl ;press-button JSR2
	;eval JSR2
	.length LDZ2 ORA #01 JCN JMP2r

	;pop JSR2 SWP2 DUP2 ADD2 SWP2 ;push JSR2
	;draw-display ( .. )

JMP2

@sfr ( -- )

	;buttons/sfr ;press-button JSR2
	;eval JSR2
	.length LDZ2 ORA #01 JCN JMP2r

	;pop JSR2 SWP2 #01 SFT2 SWP2 ;push JSR2
	;draw-display ( .. )

JMP2

@put0 ( -- )
	;buttons/0 ;press-button JSR2
	#0b ;play-note JSR2
	#00 ;append JMP2
@put1 ( -- ) 
	;buttons/1 ;press-button JSR2
	#0c ;play-note JSR2
	#01 ;append JMP2
@put2 ( -- ) 
	;buttons/2 ;press-button JSR2
	#0e ;play-note JSR2
	#02 ;append JMP2
@put3 ( -- ) 
	;buttons/3 ;press-button JSR2
	#10 ;play-note JSR2
	#03 ;append JMP2
@put4 ( -- ) 
	;buttons/4 ;press-button JSR2
	#11 ;play-note JSR2
	#04 ;append JMP2
@put5 ( -- ) 
	;buttons/5 ;press-button JSR2
	#13 ;play-note JSR2
	#05 ;append JMP2
@put6 ( -- ) 
	;buttons/6 ;press-button JSR2
	#15 ;play-note JSR2
	#06 ;append JMP2
@put7 ( -- ) 
	;buttons/7 ;press-button JSR2
	#17 ;play-note JSR2
	#07 ;append JMP2
@put8 ( -- ) 
	;buttons/8 ;press-button JSR2
	#18 ;play-note JSR2
	#08 ;append JMP2
@put9 ( -- ) 
	;buttons/9 ;press-button JSR2
	#1a ;play-note JSR2
	#09 ;append JMP2
@puta ( -- ) 
	;buttons/a ;press-button JSR2
	#09 ;play-note JSR2
	#0a ;append JMP2
@putb ( -- ) 
	;buttons/b ;press-button JSR2
	#07 ;play-note JSR2
	#0b ;append JMP2
@putc ( -- ) 
	;buttons/c ;press-button JSR2
	#21 ;play-note JSR2
	#0c ;append JMP2
@putd ( -- ) 
	;buttons/d ;press-button JSR2
	#1f ;play-note JSR2
	#0d ;append JMP2
@pute ( -- ) 
	;buttons/e ;press-button JSR2
	#1d ;play-note JSR2
	#0e ;append JMP2
@putf ( -- ) 
	;buttons/f ;press-button JSR2
	#1c ;play-note JSR2
	#0f ;append JMP2

@press-button ( button* -- )

	( set timer )
	DUP2 #0008 ADD2 #04 ROT ROT STA
	#01
	&release ( button* state -- )
	STH
	LDA2k .Screen/x DEO2
	INC2 INC2 LDA2k .Screen/y DEO2
	INC2 INC2 LDA2k ( icon )
	SWP2 INC2 INC2 LDA2 STHr ROT ROT ( .. )

JMP2

@play-note ( pitch -- )

	#24 ADD .Audio0/pitch DEO

JMP2r

(
@|drawing )

@redraw ( -- )

	#04 ;buttons/ctl ;draw-pad JSR2
	#08 ;buttons/mod ;draw-pad JSR2
	#04 ;buttons/wst ;draw-pad JSR2
	#10 ;buttons/num ;draw-pad JSR2
	;draw-mode JSR2
	;draw-display JSR2
	;update-input JSR2

	( frame )
	#0000 DUP2
	#1a
	.Screen/height DEI2 #03 SFT2 NIP #02 SUB
	;outline-frame
		;draw-frame JSR2

	( decal )
	#16 .Screen/auto DEO
	#0018 .Screen/x DEO2
	#0003 .Screen/y DEO2
	;decal-icn .Screen/addr DEO2
	#01 .Screen/sprite DEO

	( logo )
	#01 .Screen/auto DEO
	#00b0 .Screen/x DEO2
	.Screen/height DEI2 #000a SUB2 .Screen/y DEO2
	;logo-icn .Screen/addr DEO2
	#01 .Screen/sprite DEOk DEOk DEOk DEO

JMP2r

@update-input ( -- )

	#11 .Screen/auto DEO
	#0018 .Screen/x DEO2
	#0050 .Screen/y DEO2
	;fill-icn .Screen/addr DEO2

	#1600
	&loop
		#01 .Screen/sprite DEO
		INC GTHk ,&loop JCN
	POP2

@draw-input ( -- )

	&res
	#0018 .Screen/x DEO2
	#0050 .Screen/y DEO2
	#04 ;draw-num/color STA
	;input ;draw-fraction JSR2

	( draw binary )

	#05 .Screen/auto DEO
	#0038 .Screen/x DEO2
	#006c .Screen/y DEO2

	#1000
	&loop
		#0f OVR SUB .input LDZ2 ROT SFT2
			#0001 AND2 #30 SFT2 ;binary-icns ADD2 .Screen/addr DEO2
		#01 .Screen/sprite DEO
		INCk #03 AND ,&no-space JCN
			.Screen/x DEI2k #0008 ADD2 ROT DEO2
			&no-space
		INC GTHk ,&loop JCN
	POP2

JMP2r

@draw-display ( -- )

	#0010 DUP2 #1609 ;display-frame ;draw-frame JSR2
	#0018 .Screen/x DEO2
	#0018 .Screen/y DEO2
	#1606 ;fill-icn #01 ;draw-patt JSR2

	#0018 .Screen/x DEO2
	#16 ;draw-dotted JSR2

	#06 ;draw-num/color STA
	( memory )
	#0300
	&loop
		#00 OVR INC .length LDZ2 GTH2 ,&end JCN
		#0018 .Screen/x DEO2
		#00 OVR #40 SFT2 #0038 SWP2 SUB2 .Screen/y DEO2
		#00 OVR INC .length LDZ2 SWP2 SUB2 #20 SFT2 ;memory ADD2 ;draw-fraction JSR2
		INC GTHk ,&loop JCN
		&end
	POP2

JMP2r

@draw-mode ( -- )

	#05 .Screen/auto DEO
	#0010 .Screen/x DEO2
	#006c .Screen/y DEO2
	#00 .mode/dec LDZ #40 SFT2 ;mode-icns ADD2 .Screen/addr DEO2
	#01 .Screen/sprite DEOk DEO
	#00 .mode/dot LDZ #30 SFT2 ;mode-icns/dot ADD2 .Screen/addr DEO2
	#01 .Screen/sprite DEO

JMP2r

@draw-patt ( w h patt* color -- )

	,&color STR
	.Screen/addr DEO2
	.Screen/x DEI2 ,&x STR2
	#01 .Screen/auto DEO
	SWP STH
	#00
	&hloop
		[ LIT2 &x $2 ] .Screen/x DEO2
		STHkr #00
		&wloop
			[ LIT &color 0f ] .Screen/sprite DEO
			INC GTHk ,&wloop JCN
		POP2
		.Screen/y DEI2k #0008 ADD2 ROT DEO2
		INC GTHk ,&hloop JCN
	POP2
	POPr
	,&x LDR2 .Screen/x DEO2
	#00 .Screen/auto DEO

JMP2r

@draw-pad ( length sprites* -- )

	STH2
	#00
	&loop
		#00 OVR #0009 MUL2 STH2kr ADD2 #00 ;press-button/release JSR2
		INC GTHk ,&loop JCN
	POP2
	POP2r

JMP2r

@draw-button-clr ( icon* state -- )

	#09 ,draw-button-small/color STR
	,draw-button-small JSR
	#0b ,draw-button-small/color STR

JMP2r

@draw-button-small ( icon* state -- )

	#00 NEQ STH
	#26 .Screen/auto DEO
	;button-icns/alt ;button-icns/def
		STHkr [ JMP SWP2 POP2 ] STH2k .Screen/addr DEO2
	#81 .Screen/sprite DEO
	STH2r #0060 ADD2 .Screen/addr DEO2
	#81 .Screen/sprite DEO
	( icon )
	.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
	.Screen/y DEI2 #000c SUB2 #00 STHkr ADD2 .Screen/y DEO2
	#00 .Screen/auto DEO
	.Screen/addr DEO2
	#09 [ LIT &color 0b ] STHr [ JMP SWP POP ] .Screen/sprite DEOk DEO

JMP2r

@draw-button-tall ( icon* state -- )

	#00 NEQ STH
	#26 .Screen/auto DEO
	;button-icns/alt ;button-icns/def
		STHkr [ JMP SWP2 POP2 ] STH2k .Screen/addr DEO2
	#81 .Screen/sprite DEO
	( body )
	#0400
	&loop
		STH2kr #0030 ADD2 .Screen/addr DEO2
		#81 .Screen/sprite DEO
		INC GTHk ,&loop JCN
	POP2
	STH2r #0060 ADD2 .Screen/addr DEO2
	#81 .Screen/sprite DEO
	( icon )
	.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
	.Screen/y DEI2 #0010 SUB2 #00 STHkr ADD2 .Screen/y DEO2
	#00 .Screen/auto DEO
	.Screen/addr DEO2
	#090b STHr [ JMP SWP POP ] .Screen/sprite DEOk DEO

JMP2r

@draw-button-hex ( icon* state -- )

	#09 ,draw-button/color STR
	,draw-button JSR
	#0b ,draw-button/color STR

JMP2r

@draw-button ( icon* state -- )

	#00 NEQ STH
	#26 .Screen/auto DEO
	;button-icns/alt ;button-icns/def
		STHkr [ JMP SWP2 POP2 ] .Screen/addr DEO2
	#81 .Screen/sprite DEOk DEOk DEO
	( icon )
	.Screen/x DEI2 #0004 ADD2 .Screen/x DEO2
	.Screen/y DEI2 #0014 SUB2 #00 STHkr ADD2 .Screen/y DEO2
	#16 .Screen/auto DEO
	.Screen/addr DEO2
	#09 [ LIT &color 0b ] STHr [ JMP SWP POP ] .Screen/sprite DEOk DEO

JMP2r

@draw-fraction ( addr* -- )

	#01 .Screen/auto DEO
	LDA2k SWP2 INC2 INC2 LDA2
	DUP2 #0001 EQU2 ,&whole JCN
	GTH2k ,&mixed JCN

&proper ( num* den* -- )

	.mode/dot LDZ ,&proper-dot JCN
	SWP2 ,draw-value JSR
	;draw-slash JSR2
	,draw-value ( .. )

JMP

&proper-dot ( num* den* -- )

	#00 ;draw-num JSR2
	;draw-dot JSR2
	SWP2 #03e8 #1000 .mode/dec LDZ [ JMP SWP2 POP2 ] MUL2 SWP2 DIV2
	,draw-value ( .. )

JMP

&mixed ( num* den* -- )

	.mode/dot LDZ ,&mixed-dot JCN
	DIV2k ,draw-value JSR
	;draw-quote JSR2
	STH2k ( MOD2 ) [ DIV2k MUL2 SUB2 ] STH2r
	,&proper ( .. )

JMP

&mixed-dot ( num* den* -- )

	DIV2k ,draw-value JSR
	;draw-dot JSR2
	STH2k ( MOD2 ) [ DIV2k MUL2 SUB2 ] STH2r
	SWP2 #03e8 #1000 .mode/dec LDZ [ JMP SWP2 POP2 ] MUL2 SWP2 DIV2
	,draw-value ( .. )

JMP

&whole ( num* den* -- )

	POP2

@draw-value ( short* -- )

	ORAk ,&no-null JCN
		POP2 #00 ;draw-num JMP2
		&no-null

	.mode/dec LDZ ,draw-dec JCN

@draw-hex ( short* -- )

	#00 ,&z STR
	,&parse JSR
	,&parse JSR
	,&parse JSR
	,&parse JSR POP2

JMP2r
	&parse
		OVR #04 SFT DUP [ LIT &z $1 ] EQU ,&skip JCN
			#ff ,&z STR DUP ;draw-num JSR2
			&skip
		POP #40 SFT2
	JMP2r

@draw-dec ( short* -- )

	#00 ,&z STR
	#2710 ,&parse JSR
	#03e8 ,&parse JSR
	#0064 ,&parse JSR
	#000a ,&parse JSR
	NIP
	&emit
		DUP [ LIT &z $1 ] EQU ,&skip JCN
		#ff ,&z STR DUP ;draw-num JSR2
		&skip
	POP

JMP2r
	&parse
		DIV2k DUP ,&emit JSR MUL2 SUB2
	JMP2r

@hex-char ( hex -- char )

	#0f AND DUP #09 GTH #27 MUL ADD #30 ADD

JMP2r

@draw-num ( num -- )

	#00 SWP #50 SFT2 ;num-icns ADD2 .Screen/addr DEO2
	#16 .Screen/auto DEOk DEO
	[ LIT &color 01 ] .Screen/sprite DEOk DEO
	.Screen/y DEI2k #0010 SUB2 ROT DEO2
	.Screen/x DEI2k #000d ADD2 ROT DEO2

JMP2r

@draw-dot ( -- )

	;dot-icns ,draw-type JMP

@draw-quote ( -- )

	;quote-icns ,draw-type JMP

@draw-slash ( -- )

	;slash-icns

@draw-type ( addr* -- )

	.Screen/addr DEO2
	.Screen/x DEI2k INC2 INC2 INC2 ROT DEO2
	#15 .Screen/auto DEOk DEO
	#04 .Screen/sprite DEO

JMP2r

@draw-dotted ( w -- )

	#01 .Screen/auto DEO
	;&icn .Screen/addr DEO2
	#00
	&loop
		#04 .Screen/sprite DEO
		INC GTHk ,&loop JCN
	POP2

JMP2r
	&icn 0000 0055 0000 0000

@draw-frame ( x* y* w h sprite* -- )

	.Screen/addr DEO2
	,&h STR ,&w STR
	DUP2 .Screen/y DEO2 ,&y STR2
	DUP2 .Screen/x DEO2 ,&x STR2
	#01 .Screen/auto DEO
	#81 .Screen/sprite DEO
	,&next JSR [ LIT &w $1 ] ,&repeat JSR
	#02 .Screen/auto DEO
	,&next JSR #81 .Screen/sprite DEO
	,&next JSR [ LIT &h $1 ] ,&repeat JSR
	( left )
	[ LIT2 &y $2 ] #0008 ADD2 .Screen/y DEO2
	[ LIT2 &x $2 ] .Screen/x DEO2
	,&next JSR ,&h LDR ,&repeat JSR
	#01 .Screen/auto DEO
	,&next JSR #81 .Screen/sprite DEO
	,&next JSR ,&w LDR ,&repeat JSR
	,&next JSR #81 .Screen/sprite DEO
	( fill )
	,&next JSR
	,&x LDR2 #0008 ADD2 .Screen/x DEO2
	,&y LDR2 #0008 ADD2 .Screen/y DEO2

JMP2r
	&next
		.Screen/addr DEI2k #0010 ADD2 ROT DEO2
	JMP2r
	&repeat
		#00
		&repeat-loop
			#81 .Screen/sprite DEO
			INC GTHk ,&repeat-loop JCN
		POP2
	JMP2r

@draw-sel ( color -- )

	#00 .Screen/auto DEO
	;dpad-chr .Screen/addr DEO2
	#00 .cursor/d LDZ2 #30 SFT ADD #20 SFT2
		;layout ADD2 LDA2 LDA2k #0008 ADD2 .Screen/x DEO2
		INC2 INC2 LDA2 #0002 SUB2 .Screen/y DEO2
	#40 ADD .Screen/sprite DEO

JMP2r

@draw-cursor ( color -- )

	#00 .Screen/auto DEO
	.cursor/x LDZ2 .Screen/x DEO2
	.cursor/y LDZ2 .Screen/y DEO2
	.Screen/sprite DEO

JMP2r

( print )

@print ( -- )

	.length LDZ2 ORA ,&no-empty JCN
		;empty-txt ;print-str JSR2 #0a18 DEO
		JMP2r
		&no-empty

	.length LDZ2 #0001 SUB2 #20 SFT2 ;memory ADD2

@print-fraction ( addr* -- )

	LDA2k SWP2 INC2 INC2 LDA2
	DUP2 #0001 EQU2 ,&whole JCN
	GTH2k ,&mixed JCN

&proper ( num* den* -- )

	SWP2 ,print-value JSR
	LIT "/ #18 DEO
	,print-value JSR #0a18 DEO

JMP2r

&mixed ( num* den* -- )

	DIV2k ,print-value JSR STH2k ( MOD2 ) [ DIV2k MUL2 SUB2 ] STH2r
	LIT "' #18 DEO ,&proper ( .. )

JMP

&whole ( num* den* -- )

	POP2 ,print-value JSR #0a18 DEO

JMP2r

@print-value ( short* -- )

	ORAk ,&no-null JCN
		LIT "0 #18 DEO JMP2r
		&no-null

	.mode/dec LDZ ,print-dec JCN

@print-hex ( short* -- )

	#00 ,&z STR
	,&parse JSR
	,&parse JSR
	,&parse JSR
	,&parse JSR POP2

JMP2r
	&parse
		OVR #04 SFT DUP [ LIT &z $1 ] EQU ,&skip JCN
			#ff ,&z STR DUP ;hex-char JSR2 #18 DEO
			&skip
		POP #40 SFT2
	JMP2r

@print-dec ( short* -- )

	#00 ,&z STR
	#2710 ,&parse JSR
	#03e8 ,&parse JSR
	#0064 ,&parse JSR
	#000a ,&parse JSR
	NIP
	&emit
		DUP [ LIT &z $1 ] EQU ,&skip JCN
		#ff ,&z STR DUP #30 ADD #18 DEO
		&skip
	POP

JMP2r
	&parse
		DIV2k DUP ,&emit JSR MUL2 SUB2
	JMP2r

@print-str ( str* -- )

	&while
		LDAk #18 DEO
		INC2 LDAk ,&while JCN
	POP2

JMP2r

(
@|ecosystem )

@snarf-paste ( -- )

	;&snarf-txt .File/name DEO2
	#0001 .File/length DEO2
	&stream
		;&buf .File/read DEO2
		.File/success DEI2 #0000 EQU2 ,&end JCN
		[ LIT &buf 20 ] ;listen JSR2
		,&stream JMP
	&end

JMP2r
	&snarf-txt ".snarf $1

( theme )

@load-theme ( -- )

	;&path .File/name DEO2
	#0002 .File/length DEO2
	;&r .File/read DEO2
	;&g .File/read DEO2
	;&b .File/read DEO2
	.File/success DEI2 ORA #01 JCN JMP2r
	LIT2 &r $2 .System/r DEO2
	LIT2 &g $2 .System/g DEO2
	LIT2 &b $2 .System/b DEO2

JMP2r
	&path ".theme $1

(
@|stdlib )

@empty-txt "Empty 20 "Stack $1

(
@|tables )

@fncpad
	:clear :swp :dup :erase :erase :erase
	:tog-mode :inv :vid :eval :eval :eval

@numpad
	:put7 :put8 :put9 :putf
	:put4 :put5 :put6 :pute
	:put1 :put2 :put3 :putd
	:put0 :puta :putb :putc

@modpad
	:div :mul :sub :add
	:and :ora :sfl :sfr

@keys
	"~ :clear 09 :tog-mode "? :inv "@ :vid
	"+ :add "- :sub "* :mul "/ :div
	"& :and "| :ora "< :sfl "> :sfr
	20 :eval 08 :erase "% :swp "" :dup
	"7 :put7 "8 :put8 "9 :put9 "f :putf
	"4 :put4 "5 :put5 "6 :put6 "e :pute
	"1 :put1 "2 :put2 "3 :put3 "d :putd
	"0 :put0 "a :puta "b :putb "c :putc
	0d :eval
	"! :erase
	". :print
	1b :clear
	"# :set-hex
	"$ :set-dec
	&end

@layout
	:buttons/clr :clear
	:buttons/mode :tog-mode
	:buttons/7 :put7
	:buttons/8 :put8
	:buttons/9 :put9
	:buttons/f :putf
	:buttons/div :div
	:buttons/and :and
	:buttons/swp :swp
	:buttons/inv :inv
	:buttons/4 :put4
	:buttons/5 :put5
	:buttons/6 :put6
	:buttons/e :pute
	:buttons/mul :mul
	:buttons/ora :ora
	:buttons/dup :dup
	:buttons/vid :vid
	:buttons/1 :put1
	:buttons/2 :put2
	:buttons/3 :put3
	:buttons/d :putd
	:buttons/sub :sub
	:buttons/sfl :sfl
	:buttons/pop :erase
	:buttons/push :eval
	:buttons/0 :put0
	:buttons/a :puta
	:buttons/b :putb
	:buttons/c :putb
	:buttons/add :add
	:buttons/sfr :sfr

@buttons ( x* y* icon* size* state )
	&ctl
	&clr  0010 0078 :ctl-icns/clr :draw-button-clr 00
	&swp  0010 0088 :wst-icns/swp :draw-button-small 00
	&dup  0010 0098 :wst-icns/dup :draw-button-small 00
	&pop  0010 00a8 :wst-icns/pop :draw-button-tall 00
	&wst
	&mode 0028 0078 :ctl-icns/mode :draw-button-small 00
	&inv  0028 0088 :ctl-icns/inv :draw-button-small 00
	&vid  0028 0098 :ctl-icns/vid :draw-button-small 00
	&push 0028 00a8 :wst-icns/push :draw-button-tall 00
	&num
	&7   0040 0078 :num-icns/7 :draw-button 00
	&8   0058 0078 :num-icns/8 :draw-button 00
	&9   0070 0078 :num-icns/9 :draw-button 00
	&f   0088 0078 :num-icns/f :draw-button-hex 00
	&4   0040 0090 :num-icns/4 :draw-button 00
	&5   0058 0090 :num-icns/5 :draw-button 00
	&6   0070 0090 :num-icns/6 :draw-button 00
	&e   0088 0090 :num-icns/e :draw-button-hex 00
	&1   0040 00a8 :num-icns/1 :draw-button 00
	&2   0058 00a8 :num-icns/2 :draw-button 00
	&3   0070 00a8 :num-icns/3 :draw-button 00
	&d   0088 00a8 :num-icns/d :draw-button-hex 00
	&0   0040 00c0 :num-icns/0 :draw-button 00
	&a   0058 00c0 :num-icns/a :draw-button-hex 00
	&b   0070 00c0 :num-icns/b :draw-button-hex 00
	&c   0088 00c0 :num-icns/c :draw-button-hex 00
	&mod
	&div 00a0 0078 :mod-icns/div :draw-button 00
	&mul 00a0 0090 :mod-icns/mul :draw-button 00
	&sub 00a0 00a8 :mod-icns/sub :draw-button 00
	&add 00a0 00c0 :mod-icns/add :draw-button 00
	&and 00b8 0078 :mod-icns/and :draw-button 00
	&ora 00b8 0090 :mod-icns/ora :draw-button 00
	&sfl 00b8 00a8 :mod-icns/sfl :draw-button 00
	&sfr 00b8 00c0 :mod-icns/sfr :draw-button 00
	&end

(
@|assets )

@cursor-icn
	80c0 e0f0 f8e0 1000
@dpad-chr
	0000 ff81 8142 2418 0000 007e 7e3c 1800
@fill-icn
	ffff ffff ffff ffff
@logo-icn
	1824 40df 4024 1800
@patt-icn
	8800 2200 8800 2200
	aa55 aa55 aa55 aa55
@decal-icn
	001c 22c1 0000 0000
	0000 0007 8870 0000

@mode-icns
	( hex/dec )
	0018 7818 1818 7e00
	003c 607c 6666 3c00
	0018 7818 1818 7e00
	003c 6666 6666 3c00
	&dot
	( f )
	007e 6060 7c60 6000
	( d )
	007c 6666 6666 7c00

@binary-icns
	003c 6666 6666 3c00
	0018 7818 1818 7e00

@button-icns
	&def
	001f 2040 4040 4040 0000 1f3f 3f3f 3f3f 
00ff 0000 0000 0000 0000 ffff ffff ffff 
00f8 0402 0202 0202 0000 f8fc fcfc fcfc 
4040 4040 4040 4040 3f3f 3f3f 3f3f 3f3f 
0000 0000 0000 0000 ffff ffff ffff ffff 
0202 0202 0202 0202 fcfc fcfc fcfc fcfc 
4040 4040 4020 1f00 3f3f 3f3f 1f00 0000 
0000 0000 0000 ff00 ffff ffff ff00 0000 
0202 0202 0204 f800 fcfc fcfc f800 0000 

	&alt
	001f 2040 4040 4040 0000 001f 3f3f 3f3f 
00ff 0000 0000 0000 0000 00ff ffff ffff 
00f8 0402 0202 0202 0000 00f8 fcfc fcfc 
4040 4040 4040 4040 3f3f 3f3f 3f3f 3f3f 
0000 0000 0000 0000 ffff ffff ffff ffff 
0202 0202 0202 0202 fcfc fcfc fcfc fcfc 
4040 4040 4020 1f00 3f3f 3f3f 3f1f 0000 
0000 0000 0000 ff00 ffff ffff ffff 0000 
0202 0202 0204 f800 fcfc fcfc fcf8 0000 

@display-frame
001f 205f 5f5f 5f5f 0000 1f20 2020 2020 
00ff 00ff ffff ffff 0000 ff00 0000 0000 
00f8 04fa fafa fafa 0000 f804 0404 0404 
fafa fafa fafa fafa 0404 0404 0404 0404 
5f5f 5f5f 5f5f 5f5f 2020 2020 2020 2020 
5f5f 5f5f 5f20 1f00 2020 2020 201f 0000 
ffff ffff ff00 ff00 0000 0000 00ff 0000 
fafa fafa fa04 f800 0404 0404 04f8 0000


@outline-frame
0000 0000 0000 0001 0000 0000 0000 0000 
0000 0000 0000 ff00 0000 0000 0000 0000 
0000 0000 0000 0080 0000 0000 0000 0000 
4040 4040 4040 4040 0000 0000 0000 0000 
0202 0202 0202 0202 0000 0000 0000 0000 
0100 0000 0000 0000 0000 0000 0000 0000 
00ff 0000 0000 0000 0000 0000 0000 0000 
8000 0000 0000 0000 0000 0000 0000 0000 

@mod-icns
	&and
	0000 000f 1f18 180f 0000 00e0 e000 00f8
	0f18 181f 0f00 0000 f860 60e0 e000 0000
	&ora
	0000 0001 0101 0101 0000 0080 8080 8080
	0101 0101 0100 0000 8080 8080 8000 0000
	&sfl
	0000 0006 060c 0c19 0000 0060 60c0 c080
	190c 0c06 0600 0000 80c0 c060 6000 0000
	&sfr
	0000 0006 0603 0301 0000 0060 6030 3098
	0103 0306 0600 0000 9830 3060 6000 0000
	&add
	0000 0001 0101 011f 0000 0080 8080 80f8
	1f01 0101 0100 0000 f880 8080 8000 0000
	&sub
	0000 0000 0000 001f 0000 0000 0000 00f8
	1f00 0000 0000 0000 f800 0000 0000 0000
	&mul
	0000 0018 1806 0601 0000 0018 1860 6080
	0106 0618 1800 0000 8060 6018 1800 0000
	&div
	0000 0001 0100 001f 0000 0080 8000 00f8
	1f00 0001 0100 0000 f800 0080 8000 0000

@ctl-icns
	&clr 0000 183c 3c18 0000
	&mode 0000 007f fe00 0000
	&inv 006c 6666 6666 3600
	&vid 0033 6666 6666 cc00

@wst-icns
	&push 0018 3c7e 1818 1800
	&pop 0018 1818 7e3c 1800
	&swp 007c 7e02 407e 3e00
	&dup 003c 6666 6666 6c00

@num-icns
	&0
	0000 000f 1f18 1818 0000 00f0 f818 1818
	1818 181f 0f00 0000 1818 18f8 f000 0000
	&1
	0000 0003 0307 0701 0000 0080 8080 8080
	0101 0101 0100 0000 8080 8080 8000 0000
	&2
	0000 001f 1f00 000f 0000 00f0 f818 18f8
	1f18 181f 1f00 0000 f000 00f8 f800 0000
	&3
	0000 001f 1f00 001f 0000 00f0 f818 18f0
	1f00 001f 1f00 0000 f018 18f8 f000 0000
	&4
	0000 0018 1818 181f 0000 0018 1818 18f8
	0f00 0000 0000 0000 f818 1818 1800 0000
	&5
	0000 001f 1f18 181f 0000 00f8 f800 00f0
	0f00 001f 1f00 0000 f818 18f8 f000 0000
	&6
	0000 0018 1818 181f 0000 0000 0000 00f0
	1f18 181f 0f00 0000 f818 18f8 f000 0000
	&7
	0000 001f 1f00 0000 0000 00f8 f818 1830
	0000 0000 0000 0000 3060 60c0 c000 0000
	&8
	0000 000f 1f18 180f 0000 00f0 f818 18f0
	0f18 181f 0f00 0000 f018 18f8 f000 0000
	&9
	0000 000f 1f18 181f 0000 00f0 f818 18f8
	0f00 0000 0000 0000 f818 1818 1800 0000
	&a
	0000 000f 1f18 181f 0000 00f0 f818 18f8
	1f18 1818 1800 0000 f818 1818 1800 0000
	&b
	0000 001f 1f18 181f 0000 00f0 f818 18f0
	1f18 181f 1f00 0000 f018 18f8 f000 0000
	&c
	0000 000f 1f18 1818 0000 00f8 f800 0000
	1818 181f 0f00 0000 0000 00f8 f800 0000
	&d
	0000 001f 1f18 1818 0000 00f0 f818 1818
	1818 181f 1f00 0000 1818 18f8 f000 0000
	&e
	0000 001f 1f18 181f 0000 00f8 f800 00f8
	1f18 181f 1f00 0000 f800 00f8 f800 0000
	&f
	0000 000f 1f18 181f 0000 00f8 f800 0080
	1f18 1818 1800 0000 8000 0000 0000 0000

@slash-icns
0000 0006 060c 0c18
1830 3060 6000 0000
@dot-icns
0000 0000 0000 0000
0000 0018 1800 0000
@quote-icns
0000 0018 1818 0800
0000 0000 0000 0000

@tone 
8eae b5b9 c0ce dbdc cdb6 a295 8b80 7364 
5953 5256 585a 5d62 686f 7579 7d7e 8183 
8585 8483 8587 8b96 9d9e 9282 7876 7674 
706b 696c 7479 7d81 8385 898d 8d8d 8c8a 
8a88 8684 8180 7f7e 7d7c 7c7c 7c7c 7a74 
6445 221d 4179 a2b4 b7bc c7d6 ddd5 c0aa 
9b8f 867a 6b5e 5553 5456 585c 6065 6c73 
787c 7e80 8284 8484 8484 8589 919a a098 
897c 7676 7572 6e6a 6b6f 777d 7f81 8587 
8c8e 8e8d 8c8a 8988 8584 817f 7e7d 7e7d 
7c7d 7c7c 786d 5530 1a2d 5e91 aeb7 b9c1 
cfdc dacb b4a0 948b 8072 6458 5354 5558 
5a5e 636a 7076 7a7d 7f82 8484 8584 8485 
878d 969e 9d91 8177 7575 7470 6b69 6c74 
7a7e 8182 8589 8d8e 8e8d 8a8a 8887 8582 
807e 7e7d 7c7c 7c7c 7d7b 7463 4121 1e46 

(
@|memory )

@memory ( den*, num*, den*, num*, .. )