Browse code

Removed left/orca from the repo

neauoire authored on 25/05/2021 03:53:08
Showing 3 changed files
1 1
similarity index 100%
2 2
rename from projects/software/neralie.usm
3 3
rename to projects/demos/neralie.usm
4 4
deleted file mode 100644
... ...
@@ -1,718 +0,0 @@
1
-(
2
-	app/left : text editor
3
-
4
-	TODO
5
-		- Rename icon in titlebar
6
-		- Save/Load
7
-		- Double-click select word
8
-		- Right-click find next instance of selection
9
-		- Draw tab characters
10
-		- Don't redraw if nothing has changed
11
-		- Input on selection should erase selection range
12
-		- Erase on selection should erase selection range
13
-		- Scrollbar
14
-			- Don't scroll past oef
15
-			- Hor scroll
16
-			- Real scrolling distance
17
-	FIXME
18
-		- Imperfect port from previous assembler syntax
19
-)
20
-
21
-
22
-%RTN { JMP2r }
23
-%RTN? { #00 EQU #02 JCN STH2r JMP2 }
24
-
25
-%++ { #0001 ADD2 } %-- { #0001 SUB2 }
26
-%8/ { #03 SFT2 } %8* { #30 SFT2 }
27
-%8- { #0008 SUB2 } %8+ { #0008 ADD2 }
28
-
29
-( devices )
30
-
31
-|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
32
-|10 @Console [ &vector $2 &pad $6 &char $1 &byte $1 &short $2 &string $2 ]
33
-|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
34
-|80 @Controller [ &vector $2 &button $1 &key $1 ]
35
-|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &chord $1 ]
36
-|a0 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
37
-
38
-( variables )
39
-
40
-|0000
41
-
42
-@lock [ &byte $1 ]
43
-@k [ &byte $1 ]
44
-@l [ &byte $1 ]
45
-@i [ &short $2 ]
46
-@j [ &short $2 ]
47
-@addr [ &short $2 ]
48
-@selection [ &from $2 &to $2 ]
49
-@position [ &x $2 &y $2 ]
50
-@scroll [ &x $2 &y $2 ]
51
-@pt [ &x $2 &y $2 ]
52
-@mouse [ &x $2 &y $2 ]
53
-@touch [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 &state $1 ]
54
-@textarea [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 &addr $2 &cursor $1 ]
55
-@label [ &x $2 &y $2 &color $1 &addr $2 ] ( remove )
56
-
57
-( program )
58
-
59
-|0100 @RESET
60
-	
61
-	( theme ) #e0fa .System/r DEO2 #30fa .System/g DEO2 #30fa .System/b DEO2
62
-	( vectors ) ;on-mouse .Mouse/vector DEO2
63
-	( vectors ) ;on-button .Controller/vector DEO2
64
-
65
-	( load file )
66
-	;filepath ;load-file JSR2
67
-
68
-	( place textarea )
69
-	#0018 .textarea/x1 STZ2 .Screen/height DEI2 8- .textarea/y2 STZ2
70
-
71
-	;select JSR2
72
-	;redraw JSR2
73
-
74
-BRK
75
-
76
-@on-button ( -> )
77
-	
78
-	( alt + arrow )
79
-	.Controller/button DEI #0f AND #02 NEQ ,&no-alt JCN
80
-		.Controller/button DEI #04 SFT
81
-		DUP #01 NEQ ,&no-aup JCN
82
-			( sel word ) ;find-wordstart JSR2 .selection/to STZ2 &no-aup
83
-		DUP #02 NEQ ,&no-adown JCN
84
-			( sel word ) ;find-wordend JSR2 .selection/to STZ2 &no-adown
85
-		DUP #04 NEQ ,&no-aleft JCN
86
-			( sel decr ) .selection/to LDZ2 -- .selection/to STZ2 &no-aleft
87
-		DUP #08 NEQ ,&no-aright JCN
88
-			( sel incr ) .selection/to LDZ2 ++ .selection/to STZ2 &no-aright
89
-		POP
90
-		;clamp-selection JSR2
91
-		;redraw JSR2
92
-		BRK
93
-	&no-alt
94
-
95
-	( ctrl + arrow )
96
-	.Controller/button DEI #0f AND #01 NEQ ,&no-ctrl JCN
97
-		.Controller/button DEI #04 SFT
98
-		DUP #01 NEQ ,&no-cup JCN
99
-			( jump scroll ) #0004 ;scroll-up JSR2 &no-cup
100
-		DUP #02 NEQ ,&no-cdown JCN
101
-			( jump scroll ) #0004 ;scroll-down JSR2 &no-cdown
102
-		DUP #04 NEQ ,&no-cleft JCN
103
-			( jump line ) ;goto-linestart JSR2 &no-cleft
104
-		DUP #08 NEQ ,&no-cright JCN
105
-			( jump line ) ;goto-lineend JSR2 &no-cright
106
-		POP
107
-		;redraw JSR2
108
-		BRK
109
-	&no-ctrl
110
-
111
-	( arrow )
112
-	.Controller/button DEI #f0 AND #00 EQU ;&no-arrow JCN2
113
-		.Controller/button DEI #f0 AND
114
-		DUP #10 NEQ ,&no-arrowup JCN
115
-			( clamp ) .position/y LDZ2 #0000 EQU2 ,&no-arrowup JCN
116
-			;find-lineoffset JSR2 .position/x STZ2 .position/y LDZ2 -- .position/y STZ2
117
-			;find-selection JSR2 DUP2 .selection/from STZ2 ++ .selection/to STZ2 &no-arrowup
118
-		DUP #20 NEQ ,&no-arrowdown JCN
119
-			( clamp:TODO )
120
-			;find-lineoffset JSR2 .position/x STZ2 .position/y LDZ2 ++ .position/y STZ2
121
-			;find-selection JSR2 DUP2 .selection/from STZ2 ++ .selection/to STZ2 &no-arrowdown
122
-		DUP #40 NEQ ,&no-arrowleft JCN
123
-			( clamp ) .selection/from LDZ2 ;document/body EQU2 ,&no-arrowleft JCN
124
-			.selection/from LDZ2 -- DUP2 .selection/from STZ2 ++ .selection/to STZ2 &no-arrowleft
125
-		DUP #80 NEQ ,&no-arrowright JCN
126
-			( clamp:TODO )
127
-			#aa .Console/byte DEO
128
-			.selection/from LDZ2 ++ DUP2 .selection/from STZ2 ++ .selection/to STZ2 &no-arrowright
129
-		POP
130
-		;clamp-selection JSR2
131
-		;follow-selection JSR2
132
-		;redraw JSR2
133
-	&no-arrow
134
-
135
-	.Controller/key DEI #08 NEQ ,&no-backspace JCN
136
-		( erase )
137
-		.selection/to LDZ2 .selection/from LDZ2 SUB2 #0001 NEQ2 ,&erase-multiple JCN
138
-			.selection/to LDZ2 .selection/from LDZ2 SUB2 ;shift-left JSR2
139
-			;&erase-end JMP2
140
-		&erase-multiple
141
-			.selection/from LDZ2 ++ .selection/from STZ2
142
-			.selection/to LDZ2 .selection/from LDZ2 SUB2 ++ ;shift-left JSR2
143
-		&erase-end
144
-		.selection/from LDZ2 -- .selection/from STZ2
145
-		.selection/from LDZ2 ++ .selection/to STZ2
146
-		;redraw JSR2
147
-		BRK
148
-	&no-backspace
149
-
150
-	( insert )
151
-	.selection/to LDZ2 .selection/from LDZ2 SUB2 ;shift-right JSR2
152
-	.Controller/key DEI .selection/from LDZ2 STA
153
-	.selection/from LDZ2 ++ .selection/from STZ2
154
-	.selection/from LDZ2 ++ .selection/to STZ2
155
-	;redraw JSR2
156
-
157
-BRK
158
-
159
-@on-mouse ( -> )
160
-	
161
-	.Mouse/state DEI #00 EQU ,&touch-end JCN
162
-		.Mouse/x DEI2 #0010 LTH2 ;touch-linebar JCN2
163
-		.Mouse/x DEI2 .Screen/width DEI2 8- LTH2 ;touch-body JCN2
164
-		;touch-scrollbar JMP2
165
-	&touch-end
166
-
167
-	.Mouse/state DEI .touch/state STZ
168
-
169
-	;draw-cursor JSR2
170
-
171
-BRK
172
-
173
-@touch-linebar ( -- )
174
-	
175
-	#0000 .position/x STZ2
176
-	.Mouse/y DEI2 8/ .scroll/y LDZ2 ADD2 .position/y STZ2
177
-	;find-selection JSR2 DUP2 .selection/from STZ2 ++ .selection/to STZ2
178
-	;goto-linestart JSR2
179
-	;redraw JSR2
180
-	;draw-cursor JSR2
181
-
182
-BRK
183
-
184
-@touch-body ( -- )
185
-	
186
-	.Mouse/y DEI2 8/ .scroll/y LDZ2 ADD2 .position/y STZ2
187
-	.Mouse/x DEI2 .textarea/x1 LDZ2 SUB2 #0007 ADD2 #0007 DIV2 .position/x STZ2
188
-	( chords )
189
-	.Mouse/chord DEI #00 EQU ,&no-chords JCN
190
-		.Mouse/chord DEI
191
-		DUP #01 NEQ ,&no-chord-cut JCN
192
-			;cut JSR2 ( release ) #00 DUP .Mouse/state DEO .Mouse/chord DEO &no-chord-cut
193
-		DUP #10 NEQ ,&no-chord-paste JCN
194
-			;paste JSR2 ( release ) #00 DUP .Mouse/state DEO .Mouse/chord DEO &no-chord-paste
195
-		POP
196
-		;redraw JSR2
197
-		BRK
198
-	&no-chords
199
-	( drag )
200
-	.Mouse/state DEI .touch/state LDZ NEQ .Controller/button DEI #0f AND #02 NEQ #0101 EQU2 ,&no-drag JCN
201
-		( on drag )
202
-		;find-selection JSR2 ++ .selection/to STZ2
203
-		;clamp-selection JSR2
204
-		,&end JMP
205
-	&no-drag
206
-	( on click )
207
-	;find-selection JSR2 DUP2 .selection/from STZ2 ++ .selection/to STZ2
208
-	&end
209
-	.Mouse/state DEI .touch/state STZ
210
-	;draw-cursor JSR2
211
-	;redraw JSR2
212
-
213
-BRK
214
-
215
-@touch-scrollbar ( -- )
216
-
217
-	.Mouse/y DEI2 #0008 GTH2 ,&no-up JCN
218
-		( decr ) .scroll/y LDZ2 #00 .scroll/y LDZ2 #0000 NEQ2 SUB2 .scroll/y STZ2
219
-		,&end JMP
220
-	&no-up
221
-	.Mouse/y DEI2 .Screen/height DEI2 8- LTH2 ,&no-down JCN
222
-		( incr ) .scroll/y LDZ2 ++ .scroll/y STZ2
223
-		,&end JMP
224
-	&no-down
225
-	.Mouse/y DEI2 8- .scroll/y STZ2
226
-	&end
227
-	.Mouse/state DEI .touch/state STZ
228
-	;draw-cursor JSR2
229
-	;redraw JSR2
230
-
231
-BRK
232
-
233
-@load-file ( path )
234
-
235
-	.File/name DEO2 #8000 .File/length DEO2 ;document/body .File/load DEO2
236
-	( get file length )
237
-	;document/body ;document/eof STA2
238
-	&loop
239
-		( incr ) ;document/eof LDA2 ++ ;document/eof STA2
240
-	;document/eof LDA2 LDA ,&loop JCN
241
-
242
-RTN
243
-
244
-@scroll-up ( length -- )
245
-	
246
-	DUP2 .scroll/y LDZ2 LTH2 ,&clamp JCN
247
-		#0000 .scroll/y STZ2 POP2 RTN
248
-	&clamp
249
-	.scroll/y LDZ2 SWP2 SUB2 .scroll/y STZ2
250
-
251
-RTN
252
-
253
-@scroll-down ( length -- )
254
-
255
-	( TODO: Clamp )
256
-	.scroll/y LDZ2 SWP2 ADD2 .scroll/y STZ2
257
-
258
-RTN
259
-
260
-@shift-left ( length -- )
261
-
262
-	.i STZ2
263
-	.selection/from LDZ2 -- .j STZ2 ( start -> end )
264
-	&loop
265
-		( move ) .j LDZ2 .i LDZ2 ADD2 LDA .j LDZ2 STA
266
-		( incr ) .j LDZ2 ++ .j STZ2
267
-		.j LDZ2 ;document/eof LDA2 LTH2 ,&loop JCN
268
-	;document/eof LDA2 .i LDZ2 SUB2 ;document/eof STA2
269
-
270
-RTN
271
-
272
-@shift-right ( length -- )
273
-
274
-	.i STZ2
275
-	;document/eof LDA2 .j STZ2 ( end -> start )
276
-	&loop
277
-		( move ) .j LDZ2 .i LDZ2 SUB2 LDA .j LDZ2 STA
278
-		( decr ) .j LDZ2 -- .j STZ2
279
-		.j LDZ2 .selection/from LDZ2 GTH2 ,&loop JCN
280
-	;document/eof LDA2 .i LDZ2 ADD2 ;document/eof STA2
281
-
282
-RTN
283
-
284
-@follow-selection ( -- )
285
-
286
-	.position/y LDZ2 .scroll/y LDZ2 GTH2 ,&no-up JCN
287
-		.position/y LDZ2 .scroll/y STZ2 RTN
288
-	&no-up
289
-	.position/y LDZ2 .Screen/height DEI2 #0010 SUB2 8/ .scroll/y LDZ2 ADD2 LTH2 ,&no-down JCN
290
-		.position/y LDZ2 .Screen/height DEI2 #0010 SUB2 8/ SUB2 .scroll/y STZ2 RTN
291
-	&no-down
292
-
293
-RTN
294
-
295
-@clamp-selection ( -- )
296
-
297
-	.selection/from LDZ2 .selection/to LDZ2 LTH2 RTN?
298
-	.selection/from LDZ2 ++ .selection/to STZ2
299
-
300
-RTN
301
-
302
-@goto-linestart ( -- )
303
-
304
-	&loop
305
-		.selection/from LDZ2 -- LDA #0a EQU RTN?
306
-		.selection/from LDZ2 -- LDA #0d EQU RTN?
307
-		( decr ) .selection/from LDZ2 DUP2 .selection/to STZ2 -- .selection/from STZ2
308
-	.selection/from LDZ2 LDA ,&loop JCN
309
-	( clamp at document body )
310
-	.selection/from LDZ2 ;document/body GTH2 RTN?
311
-	;document/body DUP2 .selection/from STZ2 ++ .selection/to STZ2
312
-
313
-RTN
314
-
315
-@goto-lineend ( -- )
316
-	
317
-	&loop
318
-		.selection/from LDZ2 LDA #0a EQU RTN?
319
-		.selection/from LDZ2 LDA #0d EQU RTN?
320
-		( incr ) .selection/from LDZ2 ++ DUP2 ++ .selection/to STZ2 .selection/from STZ2
321
-		.selection/from LDZ2 LDA ,&loop JCN
322
-	( clamp at document body )
323
-	.selection/from LDZ2 ;document/eof LTH2 RTN?
324
-	;document/eof -- DUP2 .selection/from STZ2 ++ .selection/to STZ2
325
-
326
-RTN
327
-
328
-@find-wordstart ( -- )
329
-
330
-	.selection/to LDZ2 .j STZ2
331
-	&loop
332
-		( decr ) .j LDZ2 -- .j STZ2
333
-		.j LDZ2 LDA #20 EQU ,&end JCN
334
-		.j LDZ2 LDA #0a EQU ,&end JCN
335
-		.j LDZ2 LDA #0d EQU ,&end JCN
336
-		.j LDZ2 ;document/body GTH2 ,&loop JCN
337
-	&end
338
-	( return ) .j LDZ2 --
339
-
340
-RTN
341
-
342
-@find-wordend ( -- )
343
-	
344
-	.selection/to LDZ2 .j STZ2
345
-	&loop
346
-		( incr ) .j LDZ2 ++ .j STZ2
347
-		.j LDZ2 LDA #20 EQU ,&end JCN
348
-		.j LDZ2 LDA #0a EQU ,&end JCN
349
-		.j LDZ2 LDA #0d EQU ,&end JCN
350
-		.j LDZ2 ;document/body GTH2 ,&loop JCN
351
-	&end
352
-	( return ) .j LDZ2 ++
353
-
354
-RTN
355
-
356
-@find-lineoffset ( return character offset from linestart )
357
-
358
-	#0000 .j STZ2
359
-	&loop
360
-		( incr ) .j LDZ2 ++ .j STZ2
361
-		.selection/from LDZ2 .j LDZ2 SUB2 LDA #0a EQU ,&end JCN
362
-		.selection/from LDZ2 .j LDZ2 SUB2 LDA #0d EQU ,&end JCN
363
-		.selection/from LDZ2 .j LDZ2 SUB2 ;document/body GTH2 ,&loop JCN
364
-	&end
365
-	( return ) .j LDZ2
366
-
367
-RTN
368
-
369
-@find-line ( position -> addr )
370
-
371
-	;document/body .j STZ2 #0000 .pt/y STZ2
372
-	&loop
373
-		.pt/y LDZ2 .position/y LDZ2 -- GTH2 ,&end JCN
374
-		.j LDZ2 LDA #0a NEQ .j LDZ2 LDA #0d NEQ #0101 EQU2 ,&no-space JCN
375
-			( incr ) .pt/y LDZ2 ++ .pt/y STZ2
376
-		&no-space
377
-		( incr ) .j LDZ2 ++ .j STZ2
378
-	.j LDZ2 LDA ,&loop JCN
379
-	&end
380
-	( return ) .j LDZ2
381
-
382
-RTN
383
-
384
-@find-selection ( position -> addr )
385
-
386
-	;find-line JSR2 ( find line )
387
-	#0000 .pt/x STZ2
388
-	&loop
389
-		.j LDZ2 .pt/x LDZ2 ADD2 LDA #0a EQU ,&end JCN
390
-		.j LDZ2 .pt/x LDZ2 ADD2 LDA #0d EQU ,&end JCN
391
-		( incr ) .pt/x LDZ2 ++ .pt/x STZ2
392
-		.pt/x LDZ2 .position/x LDZ2 -- LTH2 ,&loop JCN
393
-	&end
394
-	( return ) .pt/x LDZ2 ADD2
395
-
396
-RTN
397
-
398
-@cut ( -- )
399
-
400
-	;copy JSR2
401
-	.selection/to LDZ2 .selection/from LDZ2 SUB2 ;shift-left JSR2
402
-	.selection/from LDZ2 ++ .selection/to STZ2
403
-
404
-RTN
405
-
406
-@copy ( -- )
407
-	
408
-	#0000 .i STZ2 ( start )
409
-	.selection/to LDZ2 .selection/from LDZ2 SUB2 .j STZ2 ( end )
410
-	.j LDZ2 ;clip/len STA2
411
-	&loop
412
-		.selection/from LDZ2 .i LDZ2 ADD2 LDA ;clip/body .i LDZ2 ADD2 STA
413
-		( incr ) .i LDZ2 ++ .i STZ2
414
-		.i LDZ2 .j LDZ2 LTH2 ,&loop JCN
415
-
416
-RTN
417
-
418
-@paste ( -- )
419
-	
420
-	;clip/len LDA2 ;shift-right JSR2
421
-	#0000 .i STZ2 ( start )
422
-	;clip/len LDA2 .j STZ2 ( end )
423
-	&loop
424
-		;clip/body .i LDZ2 ADD2 LDA .selection/from LDZ2 .i LDZ2 ADD2 STA
425
-		( incr ) .i LDZ2 ++ .i STZ2
426
-		.i LDZ2 .j LDZ2 LTH2 ,&loop JCN
427
-
428
-RTN
429
-
430
-@select ( position -> selection )
431
-	
432
-	;document/body .selection/from STZ2 #0000 .pt/x STZ2 #0000 .pt/y STZ2
433
-	&loop
434
-		.selection/from LDZ2 LDA #0a NEQ .selection/from LDZ2 LDA #0d NEQ #0101 EQU2 ,&no-space JCN
435
-			( incr ) .pt/y LDZ2 ++ .pt/y STZ2
436
-			#0000 .pt/x STZ2
437
-		&no-space
438
-		.pt/y LDZ2 .position/y LDZ2 -- GTH2 .pt/x LDZ2 .position/x LDZ2 -- GTH2 #0101 NEQ2 ,&no-reached JCN
439
-			.selection/from LDZ2 ++ .selection/to STZ2
440
-			RTN
441
-		&no-reached
442
-		( incr ) .pt/x LDZ2 ++ .pt/x STZ2
443
-		( incr ) .selection/from LDZ2 ++ .selection/from STZ2
444
-	.selection/from LDZ2 LDA ,&loop JCN
445
-
446
-RTN
447
-
448
-( drawing functions )
449
-
450
-@redraw
451
-
452
-	;draw-textarea JSR2
453
-	;draw-scrollbar JSR2
454
-	;draw-titlebar JSR2
455
-
456
-	( save/load icons )
457
-	.Screen/height DEI2 8- .Screen/y DEO2
458
-
459
-	.Screen/width DEI2 #0030 SUB2 .Screen/x DEO2
460
-	;eye_icn .Screen/addr DEO2
461
-	#22 .Screen/color DEO
462
-
463
-	.Screen/width DEI2 #0028 SUB2 .Screen/x DEO2
464
-	;name_icn .Screen/addr DEO2
465
-	#22 .Screen/color DEO
466
-
467
-	.Screen/width DEI2 #0020 SUB2 .Screen/x DEO2
468
-	;load_icn .Screen/addr DEO2
469
-	#22 .Screen/color DEO
470
-
471
-	.Screen/width DEI2 #0018 SUB2 .Screen/x DEO2
472
-	;save_icn .Screen/addr DEO2
473
-	#22 .Screen/color DEO
474
-
475
-RTN
476
-
477
-@draw-short ( short )
478
-
479
-	.addr STZ2
480
-	;font_hex #00 ;addr LDA #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
481
-	( draw ) #2e .Screen/color DEO
482
-	.Screen/x DEI2 8+ .Screen/x DEO2
483
-	;font_hex #00 ;addr LDA #0f AND #08 MUL ADD2 .Screen/addr DEO2
484
-	( draw ) #2e .Screen/color DEO
485
-	.Screen/x DEI2 8+ .Screen/x DEO2
486
-	;font_hex #00 ;addr ++ LDA #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
487
-	( draw ) #2e .Screen/color DEO
488
-	.Screen/x DEI2 8+ .Screen/x DEO2
489
-	;font_hex #00 ;addr ++ LDA #0f AND #08 MUL ADD2 .Screen/addr DEO2
490
-	( draw ) #2e .Screen/color DEO
491
-
492
-RTN
493
-
494
-@draw-cursor
495
-
496
-	( clear last cursor )
497
-	.mouse/x LDZ2 .Screen/x DEO2
498
-	.mouse/y LDZ2 .Screen/y DEO2
499
-	;blank_icn .Screen/addr DEO2
500
-	#30 .Screen/color DEO
501
-
502
-	( record mouse positions )
503
-	.Mouse/x DEI2 .mouse/x STZ2
504
-	.Mouse/y DEI2 .mouse/y STZ2
505
-
506
-	( draw new cursor )
507
-	.mouse/x LDZ2 .Screen/x DEO2
508
-	.mouse/y LDZ2 .Screen/y DEO2
509
-	;cursor_icn .Screen/addr DEO2
510
-	#3f .Mouse/state DEI #01 EQU #0a MUL SUB .Screen/color DEO
511
-
512
-RTN
513
-
514
-@draw-textarea ( x y color addr )
515
-	
516
-	;document/body .textarea/addr STZ2
517
-
518
-	( scroll to position )
519
-	#0000 .j STZ2 ( j is linebreaks )
520
-	&find-offset
521
-		.scroll/y LDZ2 .j LDZ2 EQU2 ,&find-offset-end JCN
522
-		.textarea/addr LDZ2 LDA #0a NEQ .textarea/addr LDZ2 LDA #0d NEQ #0101 EQU2 ,&no-break JCN
523
-			( incr ) .j LDZ2 ++ .j STZ2 &no-break
524
-		( incr ) .textarea/addr LDZ2 ++ .textarea/addr STZ2
525
-	.textarea/addr LDZ2 LDA ,&find-offset JCN
526
-	&find-offset-end
527
-
528
-	#0018 .Screen/x DEO2 #0000 .Screen/y DEO2
529
-	.textarea/addr LDZ2 .i STZ2
530
-
531
-	&loop
532
-
533
-		.Screen/y DEI2 .Screen/height DEI2 #0010 SUB2 GTH2 ;&end JCN2
534
-
535
-
536
-		.i LDZ2 LDA #0a NEQ .i LDZ2 LDA #0d NEQ #0101 EQU2 ;&no-linebreak JCN2
537
-			( draw linebreak )
538
-			;linebreak_icn .Screen/addr DEO2
539
-			( draw ) #02
540
-			.i LDZ2 .selection/from LDZ2 -- GTH2
541
-			.i LDZ2 .selection/to LDZ2 LTH2 #0101 EQU2
542
-			#26 MUL ADD .Screen/color DEO
543
-			( fill clear )
544
-			&fill-clear
545
-				( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
546
-				;font .Screen/addr DEO2
547
-				#21 .Screen/color DEO
548
-				.Screen/x DEI2 .Screen/width DEI2 8- LTH2 ,&fill-clear JCN
549
-
550
-			( draw line number )
551
-			#0000 .Screen/x DEO2
552
-			.scroll/y LDZ2 .Screen/y DEI2 8/ ADD2 DUP2 SWP POP .k STZ
553
-			.position/y LDZ2 EQU2 #05 MUL .l STZ
554
-			;font_hex #00 .k LDZ #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
555
-			#24 .l LDZ ADD .Screen/color DEO
556
-			#0008 .Screen/x DEO2
557
-			;font_hex #00 .k LDZ #0f AND #08 MUL ADD2 .Screen/addr DEO2
558
-			#24 .l LDZ ADD .Screen/color DEO
559
-
560
-			#0010 .Screen/x DEO2
561
-			( incr ) .Screen/y DEI2 8+ .Screen/y DEO2
562
-		&no-linebreak
563
-
564
-
565
-		( get character )
566
-		;font #00 .i LDZ2 LDA #20 SUB 8* ADD2 .Screen/addr DEO2
567
-		( is a special character )
568
-		.i LDZ2 LDA #20 GTH ,&no-tab JCN ;font .Screen/addr DEO2 &no-tab
569
-
570
-		( draw ) #21
571
-		.i LDZ2 .selection/from LDZ2 -- GTH2
572
-		.i LDZ2 .selection/to LDZ2 LTH2 #0101 EQU2
573
-		#05 MUL ADD .Screen/color DEO
574
-
575
-		( incr ) .i LDZ2 ++ .i STZ2
576
-		( incr ) .Screen/x DEI2 #0007 ADD2 .Screen/x DEO2
577
-
578
-	.i LDZ2 LDA ;&loop JCN2
579
-
580
-	&end
581
-
582
-RTN
583
-
584
-@draw-scrollbar ( -- )
585
-	
586
-	;scrollbar_icn ( keeping a copy on stack )
587
-
588
-	.Screen/width DEI2 8- .Screen/x DEO2
589
-	#0008 .Screen/y DEO2
590
-	DUP2 .Screen/addr DEO2
591
-
592
-	#0008 .Screen/height DEI2 8-
593
-	&loop
594
-		( draw ) #21 .Screen/color DEO
595
-		( incr ) SWP2 8+ DUP2 .Screen/y DEO2 SWP2
596
-		OVR2 OVR2 LTH2 ,&loop JCN
597
-	POP2 POP2
598
-
599
-	.scroll/y LDZ2 8+ .Screen/y DEO2
600
-	DUP2 #0008 ADD2 .Screen/addr DEO2
601
-	( draw ) #21 .Screen/color DEO
602
-
603
-	#0000 .Screen/y DEO2
604
-	DUP2 #0010 ADD2 .Screen/addr DEO2
605
-	( draw ) #24 .Screen/color DEO
606
-
607
-	.Screen/height DEI2 8- .Screen/y DEO2
608
-	#0018 ADD2 .Screen/addr DEO2
609
-	( draw ) #24 .Screen/color DEO
610
-
611
-RTN
612
-
613
-@draw-titlebar
614
-	
615
-	#0018 .Screen/height DEI2 8- #29 ;filepath
616
-	( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2 .Screen/x DEO2
617
-	.label/addr LDZ2
618
-	&loop
619
-		( draw ) DUP2 LDA #00 SWP #20 SUB 8* ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/color DEO
620
-		( incr ) ++
621
-		( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
622
-		DUP2 LDA ,&loop JCN
623
-	POP2
624
-	( selection )
625
-	.selection/from LDZ2 ;document/body SUB2 ;draw-short JSR2
626
-
627
-RTN
628
-
629
-@font_hex ( 0-F TODO: should pull from @font instead.. )
630
-[
631
-	003c 464a 5262 3c00 0018 0808 0808 1c00
632
-	003c 4202 3c40 7e00 003c 421c 0242 3c00
633
-	000c 1424 447e 0400 007e 407c 0242 3c00
634
-	003c 407c 4242 3c00 007e 0204 0810 1000
635
-	003c 423c 4242 3c00 003c 4242 3e02 3c00
636
-	003c 4242 7e42 4200 007c 427c 4242 7c00
637
-	003c 4240 4042 3c00 007c 4242 4242 7c00
638
-	007e 4078 4040 7e00 007e 4078 4040 4000
639
-]
640
-
641
-@font ( specter8-frag font )
642
-[
643
-	0000 0000 0000 0000 0008 0808 0800 0800
644
-	0014 1400 0000 0000 0024 7e24 247e 2400
645
-	0008 1e28 1c0a 3c08 0000 2204 0810 2200
646
-	0030 4832 4c44 3a00 0008 1000 0000 0000
647
-	0004 0808 0808 0400 0020 1010 1010 2000
648
-	0000 2214 0814 2200 0000 0808 3e08 0800
649
-	0000 0000 0000 0810 0000 0000 3e00 0000
650
-	0000 0000 0000 0800 0000 0204 0810 2000
651
-	003c 464a 5262 3c00 0018 0808 0808 1c00
652
-	003c 4202 3c40 7e00 003c 421c 0242 3c00
653
-	000c 1424 447e 0400 007e 407c 0242 3c00
654
-	003c 407c 4242 3c00 007e 0204 0810 1000
655
-	003c 423c 4242 3c00 003c 4242 3e02 3c00
656
-	0000 0010 0000 1000 0000 1000 0010 1020
657
-	0000 0810 2010 0800 0000 003e 003e 0000
658
-	0000 1008 0408 1000 003c 420c 1000 1000
659
-	003c 4232 4a42 3c00 003c 4242 7e42 4200
660
-	007c 427c 4242 7c00 003c 4240 4042 3c00
661
-	007c 4242 4242 7c00 007e 4078 4040 7e00
662
-	007e 4078 4040 4000 003c 4240 4642 3c00
663
-	0042 427e 4242 4200 001c 0808 0808 1c00
664
-	007e 0202 0242 3c00 0042 4478 4442 4200
665
-	0040 4040 4040 7e00 0042 665a 4242 4200
666
-	0042 6252 4a46 4200 003c 4242 4242 3c00
667
-	007c 4242 7c40 4000 003c 4242 4244 3a00
668
-	007c 4242 7c44 4200 003e 403c 0242 3c00
669
-	007e 0808 0808 1000 0042 4242 4244 3a00
670
-	0042 4242 4224 1800 0042 4242 5a66 4200
671
-	0042 423c 4242 4200 0042 423e 0242 3c00
672
-	007e 020c 3040 7e00 000c 0808 0808 0c00
673
-	0040 2010 0804 0200 0030 1010 1010 3000
674
-	0008 1400 0000 0000 0000 0000 0000 7e00
675
-	0008 0400 0000 0000 0000 3c02 3e42 3a00
676
-	0040 407c 4242 7c00 0000 3c42 4042 3c00
677
-	0002 023e 4242 3e00 0000 3c42 7e40 3e00
678
-	0000 3e40 7840 4000 0000 3c42 3e02 3c00
679
-	0040 405c 6242 4200 0008 0018 0808 0400
680
-	0008 0018 0808 4830 0040 4244 7844 4200
681
-	0010 1010 1010 0c00 0000 6c52 5252 5200
682
-	0000 5c62 4242 4200 0000 3c42 4242 3c00
683
-	0000 7c42 427c 4040 0000 3e42 423e 0202
684
-	0000 5c62 4040 4000 0000 3e40 3c02 7c00
685
-	0008 7e08 0808 1000 0000 4242 4244 3a00
686
-	0000 4242 4224 1800 0000 5252 5252 2e00
687
-	0000 4224 1824 4200 0000 4242 3e02 7c00
688
-	0000 7e02 3c40 7e00 000c 0810 1008 0c00
689
-	0008 0808 0808 0800 0030 1008 0810 3000
690
-	0000 0032 4c00 0000 3c42 99a1 a199 423c
691
-]
692
-
693
-( interface )
694
-@eye_icn
695
-	[ 0038 4492 2810 0000 ] ( open )
696
-	[ 0000 0082 4438 0000 ] ( closed )
697
-
698
-@scrollbar_icn
699
-	[ aa55 aa55 aa55 aa55 ] ( bg )
700
-	[ ffff ffff ffff ffff ] ( fg )
701
-	[ 0010 387c fe10 1010 ] ( up )
702
-	[ 0010 1010 fe7c 3810 ] ( down )
703
-
704
-@name_icn      [ 1054 28c6 2854 1000 ]
705
-@load_icn      [ feaa d6aa d4aa f400 ]
706
-@save_icn      [ fe82 8282 848a f400 ]
707
-
708
-@linebreak_icn [ 003e 7474 3414 1400 ]
709
-
710
-@blank_icn     [ 0000 0000 0000 0000 ]
711
-@cursor_icn    [ 80c0 e0f0 f8e0 1000 ]
712
-
713
-@filepath1 [ "projects/examples/gui.hover.usm 00 ]
714
-@filepath [ "README.md 00 ]
715
-
716
-@clip [ &len $2 &body $100 ]
717
-@document [ &eof $2 &body $0 ]
718
-
719 0
deleted file mode 100644
... ...
@@ -1,665 +0,0 @@
1
-( Orca
2
-	
3
-	TODO
4
-		- Synthax highlight
5
-		- B operating doesn't loop around
6
-		- Detect capitalization
7
-		- Comments
8
-		- Scale selection
9
-		- Load/Save
10
-		- Copy/Paste
11
-		- Copy/paste(chorded)
12
-)
13
-
14
-%RTN { JMP2r }
15
-%++ { #01 ADD } %-- { #01 SUB }
16
-%8++ { #0008 ADD2 }
17
-%8** { #30 SFT2 } %8// { #03 SFT2 }
18
-%MOD { DUP2 DIV MUL SUB }
19
-%MOD8 { #07 AND }
20
-%MOD2 { #01 AND }
21
-
22
-%DATA-CELLS { #2000 }
23
-%DATA-LOCKS { #3000 }
24
-%DATA-TYPES { #4000 }
25
-
26
-%LDA-CHAR { #24 MOD #00 SWP ;b36clc ADD2 LDA } ( b36 -- char )
27
-%LDA-VALUE { #20 SUB #00 SWP ;values ADD2 LDA } ( char -- b36 )
28
-
29
-%LDA-INDEX { #00 SWP #00 .grid/width LDZ MUL2 ROT #00 SWP ADD2 } ( x y -- index )
30
-%LDA-CELL { LDA-INDEX DATA-CELLS ADD2 LDA } ( x y -- char )
31
-%SET-CELL { ROT ROT LDA-INDEX DATA-CELLS ADD2 STA } ( x y char -- )
32
-%LDA-TYPE { LDA-INDEX DATA-TYPES ADD2 LDA } ( x y -- type )
33
-%SET-TYPE { ROT ROT LDA-INDEX DATA-TYPES ADD2 STA } ( x y type -- )
34
-%LDA-LOCK { LDA-INDEX DATA-TYPES ADD2 LDA } ( x y -- type )
35
-%SET-LOCK { ROT ROT LDA-INDEX DATA-TYPES ADD2 STA } ( x y type -- )
36
-%LDA-PORT { } ( x y lock -- char )
37
-%SET-PORT { } ( x y char -- )
38
-
39
-%LDA-CELL-VALUE { LDA-CELL LDA-VALUE } ( x y -- b36 )
40
-
41
-( devices )
42
-
43
-|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
44
-|10 @Console [ &vector $2 &pad $6 &char $1 &byte $1 &short $2 &string $2 ]
45
-|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
46
-|80 @Controller [ &vector $2 &button $1 &key $1 ]
47
-|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &chord $1 ]
48
-
49
-( variables )
50
-
51
-@timer [ &byte $1 &frame $1 &speed $1 ]
52
-@grid [ &width $1 &height $1 ]
53
-@selection [ &x1 $1 &y1 $1 &x2 $1 &y2 $1 ]
54
-@cursor [ &x $2 &y $2 ]
55
-
56
-|0100
57
-
58
-	( theme ) #08f3 .System/r DEO2 #08fc .System/g DEO2 #08f9 .System/b DEO2
59
-	( vectors ) ;on-button .Controller/vector DEO2
60
-	( vectors ) ;on-mouse .Mouse/vector DEO2
61
-	( vectors ) ;on-frame .Screen/vector DEO2
62
-
63
-	( find size )
64
-	.Screen/width DEI2 8// SWP POP .grid/width STZ
65
-	.Screen/height DEI2 8// SWP POP #02 SUB .grid/height STZ
66
-
67
-	( fill grid with dots )
68
-
69
-	;start JSR2
70
-	;redraw JSR2
71
-
72
-BRK
73
-
74
-@on-frame
75
-
76
-	.timer LDZ ++ DUP .timer STZ
77
-
78
-	( skip ) #08 EQU ,&tick JCN BRK &tick
79
-
80
-	.timer/frame LDZ ++ .timer/frame STZ
81
-
82
-	;run JSR2
83
-
84
-	#00 .timer STZ
85
-
86
-BRK
87
-
88
-@on-button
89
-	
90
-	.Controller/key DEI #00 EQU ,&no-key JCN
91
-		.selection/x1 LDZ .selection/y1 LDZ .Controller/key DEI SET-CELL
92
-		;redraw JSR2
93
-	&no-key
94
-
95
-	( arrows )
96
-	.Controller/button DEI #f0 AND
97
-		DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN
98
-			.selection/y1 LDZ #00 EQU ,&no-up JCN
99
-			.selection/y1 LDZ -- .selection/y1 STZ
100
-			.selection/y2 LDZ -- .selection/y2 STZ &no-up
101
-		DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN
102
-			.selection/y1 LDZ .grid/height LDZ -- EQU ,&no-down JCN
103
-			.selection/y1 LDZ ++ .selection/y1 STZ
104
-			.selection/y2 LDZ ++ .selection/y2 STZ &no-down
105
-		DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN
106
-			.selection/x1 LDZ #00 EQU ,&no-left JCN
107
-			.selection/x1 LDZ -- .selection/x1 STZ
108
-			.selection/x2 LDZ -- .selection/x2 STZ &no-left
109
-		DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN
110
-			.selection/x1 LDZ .grid/width LDZ -- EQU ,&no-right JCN
111
-			.selection/x1 LDZ ++ .selection/x1 STZ
112
-			.selection/x2 LDZ ++ .selection/x2 STZ &no-right
113
-	POP
114
-
115
-	.Controller/key DEI #08 NEQ ,&no-backspace JCN
116
-		.selection/x1 LDZ .selection/y1 LDZ #2e SET-CELL ( put . char )
117
-	&no-backspace
118
-
119
-	;redraw JSR2
120
-
121
-BRK
122
-
123
-@on-mouse
124
-	
125
-	.Mouse/state DEI #00 EQU ,&no-touch JCN
126
-		.Mouse/x DEI2 8// SWP POP .selection/x1 STZ
127
-		.Mouse/y DEI2 8// SWP POP .selection/y1 STZ
128
-		;redraw JSR2
129
-	&no-touch
130
-
131
-	( clear last cursor )
132
-	.cursor/x LDZ2 .Screen/x DEO2
133
-	.cursor/y LDZ2 .Screen/y DEO2
134
-	;blank_icn .Screen/addr DEO2
135
-	#30 .Screen/color DEO
136
-
137
-	( record cursor positions )
138
-	.Mouse/x DEI2 .cursor/x STZ2
139
-	.Mouse/y DEI2 .cursor/y STZ2
140
-
141
-	( draw new cursor )
142
-	.cursor/x LDZ2 .Screen/x DEO2
143
-	.cursor/y LDZ2 .Screen/y DEO2
144
-	;cursor_icn .Screen/addr DEO2
145
-	#32 .Mouse/state DEI #01 EQU ADD .Screen/color DEO
146
-	
147
-BRK
148
-
149
-@start ( -- )
150
-	
151
-	#00 .grid/height LDZ
152
-	&ver
153
-		#00 .grid/width LDZ
154
-		&hor
155
-			( get x,y ) SWP2 OVR STH SWP2 OVR STHr
156
-			#2e SET-CELL
157
-			( incr ) SWP ++ SWP
158
-			DUP2 LTH ,&hor JCN
159
-		POP2
160
-		( incr ) SWP ++ SWP
161
-		DUP2 LTH ,&ver JCN
162
-	POP2
163
-
164
-	#9a .timer/speed STZ
165
-
166
-RTN
167
-
168
-( operations )
169
-
170
-@get-bang ( x y -- bang )
171
-RTN
172
-
173
-( old )
174
-
175
-@is-selected ( x y -- flag )
176
-	
177
-	.selection/x1 LDZ .selection/y1 LDZ EQU2
178
-
179
-RTN
180
-
181
-@get-port ( x y lock -- value )
182
-	
183
-	(
184
-	DUP #01 NEQ ^$no-lock JCN
185
-		DUP2 #01 SET-LOCK
186
-	$no-lock
187
-	STH DUP2 #02 #02 STHr MUL ADD ,set-type JSR2
188
-	LDA-CELL
189
-	)
190
-
191
-RTN
192
-
193
-@get-cell-sprite ( x y -- addr )
194
-	
195
-	DUP2 LDA-CELL
196
-	( if character is dot )
197
-	DUP #2e NEQ ,&no-bar JCN
198
-		( check if x,y is grid )
199
-		POP
200
-		DUP2 MOD8 #00 EQU SWP MOD8 #00 EQU #0101 NEQ2 ,&no-marker8 JCN POP2 ;marker8_icn RTN &no-marker8
201
-		DUP2 MOD2 #00 EQU SWP MOD2 #00 EQU #0101 NEQ2 ,&no-marker4 JCN POP2 ;marker4_icn RTN &no-marker4
202
-		POP2 ;font RTN
203
-	&no-bar
204
-	STH POP2 STHr
205
-	#20 SUB #00 SWP 8** ;font ADD2
206
-
207
-RTN
208
-
209
-( operators )
210
-
211
-@op-a ( x y char -- )
212
-
213
-	POP
214
-	( get left ) DUP2 SWP -- SWP LDA-CELL-VALUE STH
215
-	( get right ) DUP2 SWP ++ SWP LDA-CELL-VALUE STH
216
-	( incr y ) ++
217
-	( get result ) ADDr STHr
218
-	LDA-CHAR
219
-	SET-CELL
220
-
221
-RTN
222
-
223
-@op-b ( x y char -- )
224
-	
225
-	POP
226
-	( get left ) DUP2 SWP -- SWP LDA-CELL-VALUE STH
227
-	( get right ) DUP2 SWP ++ SWP LDA-CELL-VALUE STH
228
-	( incr y ) ++
229
-	( get result ) SUBr STHr
230
-	LDA-CHAR
231
-	SET-CELL
232
-
233
-	( NOTE: Issue is not with modulo, but with converting ff to 36 )
234
-
235
-RTN
236
-
237
-@op-c ( x y char -- )
238
-	
239
-	POP
240
-	++
241
-	#30 .timer/frame LDZ MOD8 ADD SET-CELL
242
-
243
-RTN
244
-
245
-@op-d ( x y char -- )
246
-
247
-	POP POP2
248
-	
249
-RTN
250
-
251
-@op-e ( x y char -- )
252
-
253
-	POP POP2
254
-	
255
-RTN
256
-
257
-@op-f ( x y char -- )
258
-
259
-	POP POP2
260
-	
261
-RTN
262
-
263
-@op-g ( x y char -- )
264
-
265
-	POP POP2
266
-	
267
-RTN
268
-
269
-@op-h ( x y char -- )
270
-
271
-	POP POP2
272
-	
273
-RTN
274
-
275
-@op-i ( x y char -- )
276
-
277
-	POP POP2
278
-	
279
-RTN
280
-
281
-@op-j ( x y char -- )
282
-
283
-	POP POP2
284
-	
285
-RTN
286
-
287
-@op-k ( x y char -- )
288
-
289
-	POP POP2
290
-	
291
-RTN
292
-
293
-@op-l ( x y char -- )
294
-
295
-	POP POP2
296
-	
297
-RTN
298
-
299
-@op-m ( x y char -- )
300
-
301
-	POP POP2
302
-	
303
-RTN
304
-
305
-@op-n ( x y char -- )
306
-	
307
-	STH
308
-	( limit )
309
-	DUP ,&not-edge JCN
310
-		#2a SET-CELL POP STHr RTN
311
-	&not-edge
312
-	( collide )
313
-	DUP2 -- LDA-CELL #2e EQU ,&not-collide JCN
314
-		#2a SET-CELL POP STHr RTN
315
-	&not-collide
316
-	( move )
317
-	DUP2 STHr
318
-	SWP -- SWP SET-CELL	
319
-	#2e SET-CELL
320
-	
321
-RTN
322
-
323
-@op-o ( x y char -- )
324
-
325
-	POP POP2
326
-	
327
-RTN
328
-
329
-@op-p ( x y char -- )
330
-
331
-	POP POP2
332
-	
333
-RTN
334
-
335
-@op-q ( x y char -- )
336
-
337
-	POP POP2
338
-	
339
-RTN
340
-
341
-@op-r ( x y char -- )
342
-
343
-	POP POP2
344
-	
345
-RTN
346
-
347
-@op-s ( x y char -- )
348
-	
349
-	STH
350
-	( clear ) DUP2 #2e SET-CELL
351
-	( move ) ++ DUP2 #01 SET-LOCK
352
-	STHr SET-CELL
353
-	
354
-RTN
355
-
356
-@op-t ( x y char -- )
357
-
358
-	POP POP2
359
-	
360
-RTN
361
-
362
-@op-u ( x y char -- )
363
-
364
-	POP POP2
365
-	
366
-RTN
367
-
368
-@op-v ( x y char -- )
369
-
370
-	POP POP2
371
-	
372
-RTN
373
-
374
-@op-w ( x y char -- )
375
-
376
-	STH
377
-	( limit )
378
-	OVR ,&not-edge JCN
379
-		#2a SET-CELL POP STHr RTN
380
-	&not-edge
381
-	( collide )
382
-	DUP2 SWP -- SWP LDA-CELL #2e EQU ,&not-collide JCN
383
-		#2a SET-CELL POP STHr RTN
384
-	&not-collide
385
-	( move )
386
-	DUP2
387
-	SWP -- SWP STHr SET-CELL	
388
-	#2e SET-CELL
389
-	
390
-RTN
391
-
392
-@op-x ( x y char -- )
393
-
394
-	POP POP2
395
-	
396
-RTN
397
-
398
-@op-y ( x y char -- )
399
-
400
-	POP POP2
401
-	
402
-RTN
403
-
404
-@op-z ( x y char -- )
405
-
406
-	POP POP2
407
-	
408
-RTN
409
-
410
-@op-bang ( x y char -- )
411
-
412
-	POP
413
-	#2e SET-CELL
414
-
415
-RTN
416
-
417
-@run-char ( x y char -- )
418
-	
419
-	( skip dot )
420
-	DUP #2e NEQ ,&not-dot JCN
421
-		POP POP2 RTN
422
-	&not-dot
423
-
424
-	( skip locked )
425
-	ROT ROT DUP2 LDA-LOCK #00 EQU ,&not-locked JCN
426
-		POP POP2 RTN
427
-	&not-locked
428
-	ROT
429
-
430
-	( A ) DUP #41 EQU ;op-a JCN2 ( B ) DUP #42 EQU ;op-b JCN2
431
-	( C ) DUP #43 EQU ;op-c JCN2 ( D ) DUP #44 EQU ;op-d JCN2
432
-	( E ) DUP #45 EQU ;op-e JCN2 ( F ) DUP #46 EQU ;op-f JCN2
433
-	( G ) DUP #47 EQU ;op-g JCN2 ( H ) DUP #48 EQU ;op-h JCN2
434
-	( I ) DUP #49 EQU ;op-i JCN2 ( J ) DUP #4a EQU ;op-j JCN2
435
-	( K ) DUP #4b EQU ;op-k JCN2 ( L ) DUP #4c EQU ;op-l JCN2
436
-	( M ) DUP #4d EQU ;op-m JCN2 ( N ) DUP #4e EQU ;op-n JCN2
437
-	( O ) DUP #4f EQU ;op-o JCN2 ( P ) DUP #50 EQU ;op-p JCN2
438
-	( Q ) DUP #51 EQU ;op-q JCN2 ( R ) DUP #52 EQU ;op-r JCN2
439
-	( S ) DUP #53 EQU ;op-s JCN2 ( T ) DUP #54 EQU ;op-t JCN2
440
-	( U ) DUP #55 EQU ;op-u JCN2 ( V ) DUP #56 EQU ;op-v JCN2
441
-	( W ) DUP #57 EQU ;op-w JCN2 ( X ) DUP #58 EQU ;op-x JCN2
442
-	( Y ) DUP #59 EQU ;op-y JCN2 ( Z ) DUP #5a EQU ;op-z JCN2
443
-	( * ) DUP #2a EQU ;op-bang JCN2
444
-	POP POP2
445
-
446
-RTN
447
-
448
-@init ( -- )
449
-	
450
-	#00 .grid/height LDZ
451
-	&ver
452
-		#00 .grid/width LDZ
453
-		&hor
454
-			( get x,y ) SWP2 OVR STH SWP2 OVR STHr
455
-			( unlock ) #00 SET-LOCK
456
-			( incr ) SWP ++ SWP
457
-			DUP2 LTH ,&hor JCN
458
-		POP2
459
-		( incr ) SWP ++ SWP
460
-		DUP2 LTH ,&ver JCN
461
-	POP2
462
-
463
-RTN
464
-
465
-@run ( -- )
466
-	
467
-	;init JSR2
468
-
469
-	#00 .grid/height LDZ
470
-	&ver
471
-		#00 .grid/width LDZ
472
-		&hor
473
-			( get x,y ) SWP2 OVR STH SWP2 OVR STHr
474
-			DUP2 LDA-CELL ;run-char JSR2
475
-			( incr ) SWP ++ SWP
476
-			DUP2 LTH ,&hor JCN
477
-		POP2
478
-		( incr ) SWP ++ SWP
479
-		DUP2 LTH ,&ver JCN
480
-	POP2
481
-	;redraw JSR2
482
-
483
-RTN
484
-
485
-@draw-interface ( -- )
486
-	
487
-	.Screen/height DEI2 #0008 SUB2 .Screen/y DEO2
488
-
489
-	( Positionx )
490
-	#0000 .Screen/x DEO2
491
-	.selection/x1 LDZ
492
-		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
493
-	#22 .Screen/color DEO
494
-	#0008 .Screen/x DEO2
495
-		#0f AND LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
496
-	#22 .Screen/color DEO
497
-
498
-	( Positiony )
499
-	#0010 .Screen/x DEO2
500
-	.selection/y1 LDZ
501
-		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
502
-	#22 .Screen/color DEO
503
-	#0018 .Screen/x DEO2
504
-		#0f AND LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
505
-	#22 .Screen/color DEO
506
-
507
-	#0020 .Screen/x DEO2
508
-	;position_icn .Screen/addr DEO2
509
-	#23 .Screen/color DEO
510
-
511
-	( Frame )
512
-	#0030 .Screen/x DEO2
513
-	.timer/frame LDZ
514
-		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
515
-	#22 .Screen/color DEO
516
-	#0038 .Screen/x DEO2
517
-		#0f AND LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
518
-	#22 .Screen/color DEO
519
-
520
-	#0040 .Screen/x DEO2
521
-	;beat_icn .Screen/addr DEO2
522
-	#21 .timer/frame LDZ MOD8 #00 EQU #02 MUL ADD .Screen/color DEO
523
-
524
-	( Speed )
525
-	#0050 .Screen/x DEO2
526
-	.timer/speed LDZ
527
-		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
528
-	#22 .Screen/color DEO
529
-	#0058 .Screen/x DEO2
530
-		#0f AND LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
531
-	#22 .Screen/color DEO
532
-
533
-	( TODO: Signal VU )
534
-
535
-	( File )
536
-	.Screen/width DEI2 #0028 SUB2 .Screen/x DEO2
537
-	.Screen/x DEI2 8++ .Screen/x DEO2 ;eye_icns .Screen/addr DEO2 #21 .Screen/color DEO
538
-	.Screen/x DEI2 8++ .Screen/x DEO2 ;filestate_icn .Screen/addr DEO2 #21 .Screen/color DEO
539
-	.Screen/x DEI2 8++ .Screen/x DEO2 ;load_icn .Screen/addr DEO2 #21 .Screen/color DEO
540
-	.Screen/x DEI2 8++ .Screen/x DEO2 ;save_icn .Screen/addr DEO2 #21 .Screen/color DEO
541
-
542
-RTN
543
-
544
-@redraw ( -- )
545
-	
546
-	#00 .grid/height LDZ
547
-	&ver
548
-		( pos-y ) OVR #00 SWP 8** .Screen/y DEO2
549
-		#00 .grid/width LDZ
550
-		&hor
551
-			( pos-x ) OVR #00 SWP 8** .Screen/x DEO2
552
-			( get x,y ) SWP2 OVR STH SWP2 OVR STHr
553
-			( sprite ) DUP2 ;get-cell-sprite JSR2 .Screen/addr DEO2
554
-			( draw ) ;is-selected JSR2 #0d MUL #21 ADD .Screen/color DEO
555
-			( incr ) SWP ++ SWP
556
-			DUP2 LTH ,&hor JCN
557
-		POP2
558
-		( incr ) SWP ++ SWP
559
-		DUP2 LTH ,&ver JCN
560
-	POP2
561
-
562
-	;draw-interface JSR2
563
-
564
-RTN
565
-
566
-( char to b36 )
567
-
568
-@values [
569
-	
570
-	00 00 00 00 00 00 00 00
571
-	00 00 00 00 00 00 00 00
572
-
573
-	00 01 02 03 04 05 06 07
574
-	08 09 00 00 00 00 00 00
575
-
576
-	00 0a 0b 0c 0d 0e 0f 10
577
-	11 12 13 14 15 16 17 18
578
-	19 1a 1b 1c 1d 1e 1f 20
579
-	21 22 23 00 00 00 00 00
580
-
581
-	00 0a 0b 0c 0d 0e 0f 10
582
-	11 12 13 14 15 16 17 18
583
-	19 1a 1b 1c 1d 1e 1f 20
584
-	21 22 23 00 00 00 00 00
585
-
586
-]
587
-
588
-( b36 to char-lc )
589
-
590
-@b36clc [
591
-	30 31 32 33 34 35 36 37
592
-	38 39 61 62 63 64 65 66
593
-	67 68 69 6a 6b 6c 6d 6e
594
-	6f 70 71 72 73 74 75 76
595
-	77 78 79 7a
596
-]
597
-
598
-@cursor_icn     [ 80c0 e0f0 f8e0 1000 ]
599
-@blank_icn      [ 0000 0000 0000 0000 ]
600
-@position_icn   [ 0066 4200 0042 6600 ]
601
-@beat_icn       [ 0000 1038 7c38 1000 ]
602
-@marker8_icn    [ 0000 2400 0024 0000 ]
603
-@marker4_icn    [ 0000 0000 0000 1000 ]
604
-@filestate_icn  [ 1054 28c6 2854 1000 ]
605
-@load_icn       [ feaa d6aa d4aa f400 ]
606
-@save_icn       [ fe82 8282 848a f400 ]
607
-
608
-@eye_icns
609
-	[ 0038 4492 2810 0000 ] ( open )
610
-	[ 0000 0082 4438 0000 ] ( closed )
611
-
612
-
613
-@font ( specter8-frag font )
614
-[
615
-	0000 0000 0000 0000 0008 0808 0800 0800
616
-	0014 1400 0000 0000 0024 7e24 247e 2400
617
-	0008 1e28 1c0a 3c08 0000 2204 0810 2200
618
-	0030 4832 4c44 3a00 0008 1000 0000 0000
619
-	0004 0808 0808 0400 0020 1010 1010 2000
620
-	005a 2442 4224 5a00 0000 0808 3e08 0800
621
-	0000 0000 0000 0810 0000 0000 3e00 0000
622
-	0000 0000 0000 0800 0000 0204 0810 2000
623
-	003c 464a 5262 3c00 0018 0808 0808 1c00
624
-	003c 4202 3c40 7e00 003c 421c 0242 3c00
625
-	000c 1424 447e 0400 007e 407c 0242 3c00
626
-	003c 407c 4242 3c00 007e 0204 0810 1000
627
-	003c 423c 4242 3c00 003c 4242 3e02 3c00
628
-	0000 0010 0000 1000 0000 1000 0010 1020
629
-	0000 0810 2010 0800 0000 003e 003e 0000
630
-	0000 1008 0408 1000 003c 420c 1000 1000
631
-	003c 4232 4a42 3c00 003c 4242 7e42 4200
632
-	007c 427c 4242 7c00 003c 4240 4042 3c00
633
-	007c 4242 4242 7c00 007e 4078 4040 7e00
634
-	007e 4078 4040 4000 003c 4240 4642 3c00
635
-	0042 427e 4242 4200 001c 0808 0808 1c00
636
-	007e 0202 0242 3c00 0042 4478 4442 4200
637
-	0040 4040 4040 7e00 0042 665a 4242 4200
638
-	0042 6252 4a46 4200 003c 4242 4242 3c00
639
-	007c 4242 7c40 4000 003c 4242 4244 3a00
640
-	007c 4242 7c44 4200 003e 403c 0242 3c00
641
-	007e 0808 0808 1000 0042 4242 4244 3a00
642
-	0042 4242 4224 1800 0042 4242 5a66 4200
643
-	0042 423c 4242 4200 0042 423e 0242 3c00
644
-	007e 020c 3040 7e00 000c 0808 0808 0c00
645
-	0040 2010 0804 0200 0030 1010 1010 3000
646
-	0008 1400 0000 0000 0000 0000 0000 7e00
647
-	0008 0400 0000 0000 0000 3c02 3e42 3a00
648
-	0040 407c 4242 7c00 0000 3c42 4042 3c00
649
-	0002 023e 4242 3e00 0000 3c42 7e40 3e00
650
-	0000 3e40 7840 4000 0000 3c42 3e02 3c00
651
-	0040 405c 6242 4200 0008 0018 0808 0400
652
-	0008 0018 0808 4830 0040 4244 7844 4200
653
-	0010 1010 1010 0c00 0000 6c52 5252 5200
654
-	0000 5c62 4242 4200 0000 3c42 4242 3c00
655
-	0000 7c42 427c 4040 0000 3e42 423e 0202
656
-	0000 5c62 4040 4000 0000 3e40 3c02 7c00
657
-	0008 7e08 0808 1000 0000 4242 4244 3a00
658
-	0000 4242 4224 1800 0000 5252 5252 2e00
659
-	0000 4224 1824 4200 0000 4242 3e02 7c00
660
-	0000 7e02 3c40 7e00 000c 0810 1008 0c00
661
-	0008 0808 0808 0800 0030 1008 0810 3000
662
-	0000 0032 4c00 0000 3c42 99a1 a199 423c
663
-]
664
-
665
-@data [ ]
666 0
\ No newline at end of file