... | ... |
@@ -22,20 +22,19 @@ |
22 | 22 |
%++ { #0001 ADD2 } %-- { #0001 SUB2 } |
23 | 23 |
%2/ { #0001 SFT2 } |
24 | 24 |
%8/ { #0003 SFT2 } %8* { #0030 SFT2 } |
25 |
-%8+ { #0008 ADD2 } %8- { #0008 SUB2 } |
|
25 |
+%8+ { #0008 ADD2 } |
|
26 |
+%FILESIZE { ~canvas.w ~canvas.h MUL2 #0008 MUL2 } |
|
26 | 27 |
|
27 | 28 |
( variables ) |
28 | 29 |
|
29 | 30 |
;cursor { x 2 y 2 x0 2 y0 2 dx 2 dy 2 } |
30 | 31 |
;brush { tool 1 size 1 patt 1 drag 1 last 1 oper 2 } |
31 | 32 |
;zoom { active 1 x 2 y 2 } |
32 |
-( interface ) |
|
33 | 33 |
;toolpane { x1 2 y1 2 x2 2 y2 2 } |
34 | 34 |
;pattpane { x1 2 y1 2 x2 2 y2 2 } |
35 | 35 |
;sizepane { x1 2 y1 2 x2 2 y2 2 } |
36 | 36 |
;viewpane { x1 2 y1 2 x2 2 y2 2 } |
37 | 37 |
;canvas { x1 2 y1 2 x2 2 y2 2 w 2 h 2 } |
38 |
- |
|
39 | 38 |
;rect { x1 2 y1 2 x2 2 y2 2 } |
40 | 39 |
;line { x1 2 y1 2 x2 2 y2 2 sx 2 sy 2 dx 2 dy 2 e1 2 e2 2 } |
41 | 40 |
;origin { x1 2 y1 2 x2 2 y2 2 } |
... | ... |
@@ -44,7 +43,8 @@ |
44 | 43 |
;pt1 { x 2 y 2 } |
45 | 44 |
;pt2 { x 2 y 2 } ( paint-rect ) |
46 | 45 |
;px { x 1 y 1 } |
47 |
-;document { state 1 edit 1 namelength 1 name 20 } |
|
46 |
+;document { state 1 edit 1 } |
|
47 |
+;path { length 1 name 20 } |
|
48 | 48 |
;timer { byte 1 } |
49 | 49 |
|
50 | 50 |
( devices ) |
... | ... |
@@ -52,53 +52,46 @@ |
52 | 52 |
|0100 ;Console { pad 8 char 1 byte 1 short 2 string 2 } |
53 | 53 |
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 } |
54 | 54 |
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } |
55 |
-|0130 ;Controller { buttons 1 } |
|
55 |
+|0130 ;Controller { p1 1 } |
|
56 | 56 |
|0140 ;Keys { key 1 } |
57 | 57 |
|0150 ;Mouse { x 2 y 2 state 1 chord 1 } |
58 | 58 |
|0160 ;File { pad 8 name 2 length 2 load 2 save 2 } |
59 | 59 |
|01F0 ;System { pad 8 r 2 g 2 b 2 } |
60 |
- |
|
61 | 60 |
|0200 ,RESET JMP2 |
62 | 61 |
|0204 ,ERROR JMP2 |
63 | 62 |
|0208 ,FRAME JMP2 |
64 | 63 |
|
65 | 64 |
( program ) |
66 | 65 |
|
67 |
-@RESET |
|
66 |
+@RESET ( -- ) |
|
68 | 67 |
|
69 |
- ( theme ) #e0fd =System.r #30fd =System.g #30fd =System.b |
|
68 |
+ ( theme ) |
|
69 |
+ #e0fd =System.r #30fd =System.g #30fd =System.b |
|
70 | 70 |
|
71 | 71 |
( default canvas ) |
72 | 72 |
#002a =canvas.w #001a =canvas.h |
73 | 73 |
|
74 | 74 |
( default brush ) |
75 |
- #04 =brush.size |
|
76 |
- #00 =brush.patt |
|
77 |
- #00 =brush.tool |
|
75 |
+ #04 =brush.size #00 =brush.patt #00 =brush.tool |
|
78 | 76 |
|
79 | 77 |
( load file ) |
80 |
- ,document.name ,load-file JSR2 |
|
78 |
+ ,path.name ,load-file JSR2 |
|
81 | 79 |
|
82 | 80 |
( setup panes ) |
83 |
- #0010 =toolpane.x1 #0010 =toolpane.y1 |
|
84 |
- ~Screen.width #0050 SUB2 =pattpane.x1 #0010 =pattpane.y1 |
|
85 |
- #0040 =sizepane.x1 #0010 =sizepane.y1 |
|
86 |
- ~Screen.width #0078 SUB2 =viewpane.x1 #0010 =viewpane.y1 |
|
81 |
+ #0010 =toolpane.x1 #0010 =toolpane.y1 ~toolpane.x1 #0028 ADD2 =toolpane.x2 ~toolpane.y1 #0008 ADD2 =toolpane.y2 |
|
82 |
+ #0040 =sizepane.x1 #0010 =sizepane.y1 ~sizepane.x1 #0040 ADD2 =sizepane.x2 ~sizepane.y1 #0008 ADD2 =sizepane.y2 |
|
83 |
+ ~Screen.width #0078 SUB2 =viewpane.x1 #0010 =viewpane.y1 ~viewpane.x1 #0020 ADD2 =viewpane.x2 ~viewpane.y1 #0008 ADD2 =viewpane.y2 |
|
84 |
+ ~Screen.width #0050 SUB2 =pattpane.x1 #0010 =pattpane.y1 ~pattpane.x1 #0040 ADD2 =pattpane.x2 ~pattpane.y1 #0008 ADD2 =pattpane.y2 |
|
87 | 85 |
|
88 |
- ~toolpane.x1 #0028 ADD2 =toolpane.x2 ~toolpane.y1 #0008 ADD2 =toolpane.y2 |
|
89 |
- ~pattpane.x1 #0040 ADD2 =pattpane.x2 ~pattpane.y1 #0008 ADD2 =pattpane.y2 |
|
90 |
- ~sizepane.x1 #0040 ADD2 =sizepane.x2 ~sizepane.y1 #0008 ADD2 =sizepane.y2 |
|
91 |
- ~viewpane.x1 #0020 ADD2 =viewpane.x2 ~viewpane.y1 #0008 ADD2 =viewpane.y2 |
|
92 |
- |
|
93 |
- ( center canvas ) |
|
86 |
+ ( ready. ) |
|
94 | 87 |
,center JSR2 |
95 | 88 |
,clear JSR2 |
96 | 89 |
|
97 | 90 |
BRK |
98 | 91 |
|
99 |
-@FRAME |
|
92 |
+@FRAME ( -- ) |
|
100 | 93 |
|
101 |
- ~document.edit #01 EQU ,on-document-edit JNZ2 |
|
94 |
+ ~document.edit #01 EQU ,on-rename JNZ2 |
|
102 | 95 |
|
103 | 96 |
,draw-cursor JSR2 |
104 | 97 |
|
... | ... |
@@ -108,10 +101,7 @@ BRK |
108 | 101 |
~canvas.x1 -- ~canvas.y1 -- ~canvas.x2 ~canvas.y2 #10 ,line-rect JSR2 |
109 | 102 |
,draw-background JSR2 |
110 | 103 |
,fit-canvas JSR2 |
111 |
- ,draw-toolpane JSR2 |
|
112 |
- ,draw-pattpane JSR2 |
|
113 |
- ,draw-sizepane JSR2 |
|
114 |
- ,draw-viewpane JSR2 |
|
104 |
+ ,draw-foreground JSR2 |
|
115 | 105 |
#00 =brush.drag |
116 | 106 |
$no-release |
117 | 107 |
|
... | ... |
@@ -243,18 +233,17 @@ BRK |
243 | 233 |
~Mouse.y STEP8 ~Screen.height #0010 SUB2 NEQ2 ^$no-touch-background JNZ |
244 | 234 |
~Mouse.x ~Screen.width #0020 SUB2 SUB2 8/ |
245 | 235 |
DUP2 #0000 NEQ2 ^$no-clear-button JNZ |
246 |
- ,center JSR2 |
|
247 | 236 |
,clear JSR2 |
248 | 237 |
#01 =document.edit |
249 | 238 |
( release ) #00 =Mouse.state |
250 | 239 |
$no-clear-button |
251 | 240 |
DUP2 #0001 NEQ2 ^$no-load-button JNZ |
252 |
- ,document.name ,load-file JSR2 |
|
241 |
+ ,path.name ,load-file JSR2 |
|
253 | 242 |
,draw-canvas JSR2 |
254 | 243 |
( release ) #00 =Mouse.state |
255 | 244 |
$no-load-button |
256 | 245 |
DUP2 #0002 NEQ2 ^$no-save-button JNZ |
257 |
- ,document.name ,save-file JSR2 |
|
246 |
+ ,path.name ,save-file JSR2 |
|
258 | 247 |
( release ) #00 =Mouse.state |
259 | 248 |
$no-save-button |
260 | 249 |
POP2 |
... | ... |
@@ -265,16 +254,18 @@ BRK |
265 | 254 |
|
266 | 255 |
$no-touch |
267 | 256 |
|
268 |
- ~Controller.buttons #f0 AND |
|
269 |
- DUP #04 SFT #01 AND #01 NEQ ^$no-up JNZ |
|
270 |
- ( move ) ~zoom.y -- =zoom.y $no-up |
|
271 |
- DUP #05 SFT #01 AND #01 NEQ ^$no-down JNZ |
|
272 |
- ( move ) ~zoom.y ++ =zoom.y $no-down |
|
273 |
- DUP #06 SFT #01 AND #01 NEQ ^$no-left JNZ |
|
274 |
- ( move ) ~zoom.x -- =zoom.x $no-left |
|
275 |
- DUP #07 SFT #01 AND #01 NEQ ^$no-right JNZ |
|
276 |
- ( move ) ~zoom.x ++ =zoom.x $no-right |
|
277 |
- #00 EQU #04 JNZ ,draw-canvas JSR2 |
|
257 |
+ ~Controller.p1 #00 EQU ,$no-ctrl JNZ2 |
|
258 |
+ ~Controller.p1 #f0 AND |
|
259 |
+ DUP #04 SFT #01 AND #01 NEQ ^$no-up JNZ |
|
260 |
+ ( move ) ~zoom.y -- =zoom.y $no-up |
|
261 |
+ DUP #05 SFT #01 AND #01 NEQ ^$no-down JNZ |
|
262 |
+ ( move ) ~zoom.y ++ =zoom.y $no-down |
|
263 |
+ DUP #06 SFT #01 AND #01 NEQ ^$no-left JNZ |
|
264 |
+ ( move ) ~zoom.x -- =zoom.x $no-left |
|
265 |
+ DUP #07 SFT #01 AND #01 NEQ ^$no-right JNZ |
|
266 |
+ ( move ) ~zoom.x ++ =zoom.x $no-right |
|
267 |
+ #00 EQU #04 JNZ ,draw-canvas JSR2 |
|
268 |
+ $no-ctrl |
|
278 | 269 |
|
279 | 270 |
~Keys #00 EQU ,$no-keys JNZ2 |
280 | 271 |
~Keys |
... | ... |
@@ -305,44 +296,44 @@ BRK |
305 | 296 |
|
306 | 297 |
BRK |
307 | 298 |
|
308 |
-@on-document-edit |
|
299 |
+@on-rename ( -- ) |
|
309 | 300 |
|
310 | 301 |
~Keys #00 EQU ,$no-keys JNZ2 |
311 |
- ~Keys #0d NEQ ,$no-enter JNZ2 |
|
302 |
+ ( enter ) |
|
303 |
+ ~Keys #0d NEQ ^$no-enter JNZ |
|
312 | 304 |
#00 =document.edit |
313 |
- ,redraw JSR2 |
|
314 |
- BRK |
|
315 |
- $no-enter |
|
316 |
- ~Keys #08 NEQ ,$no-backspace JNZ2 |
|
317 |
- ~document.namelength #00 EQU ,$end JNZ2 |
|
318 |
- ( incr ) ~document.namelength #01 SUB =document.namelength |
|
319 |
- ,$end JSR2 |
|
320 |
- BRK |
|
321 |
- $no-backspace |
|
322 |
- ~document.namelength #1f EQU ,$end JNZ2 |
|
323 |
- ( store key ) ~Keys ,document.name #00 ~document.namelength ADD2 POK2 |
|
324 |
- ( incr ) ~document.namelength #01 ADD =document.namelength |
|
325 |
- $end |
|
326 |
- ( store end ) #00 ,document.name #00 ~document.namelength ADD2 POK2 |
|
327 |
- ( release ) #00 =Keys.key |
|
305 |
+ ,redraw JSR2 BRK |
|
306 |
+ $no-enter |
|
307 |
+ ( backspace ) |
|
308 |
+ ~Keys #08 NEQ ^$no-backspace JNZ |
|
309 |
+ ~path.length #00 EQU ^$end JNZ |
|
310 |
+ ~path.length #01 SUB =path.length |
|
311 |
+ ^$end JMP |
|
312 |
+ $no-backspace |
|
313 |
+ ( default ) |
|
314 |
+ ~path.length #1f EQU ^$end JNZ |
|
315 |
+ ~Keys ,path.name #00 ~path.length ADD2 POK2 |
|
316 |
+ ~path.length #01 ADD =path.length |
|
317 |
+ $end |
|
318 |
+ #00 ,path.name #00 ~path.length ADD2 POK2 |
|
319 |
+ #00 =Keys.key |
|
328 | 320 |
$no-keys |
329 |
- |
|
330 |
- ( move ) #0008 =Sprite.x ~Screen.height #0010 SUB2 =Sprite.y |
|
331 |
- ( draw ) ,document.name #01 ~timer #04 DIV #03 AND #03 MUL ADD ,draw-label JSR2 |
|
332 |
- |
|
333 |
- ~Sprite.x 8- =Sprite.x |
|
321 |
+ ( draw ) |
|
322 |
+ #0008 =Sprite.x ~Screen.height #0010 SUB2 =Sprite.y |
|
323 |
+ ,path.name #01 ~timer #04 DIV #03 AND #03 MUL ADD ,draw-label JSR2 |
|
334 | 324 |
$clear |
335 |
- ~Sprite.x 8+ =Sprite.x |
|
336 | 325 |
#00 =Sprite.color |
337 |
- ~Sprite.x ~Screen.width LTH2 ^$clear JNZ |
|
338 |
- |
|
326 |
+ ~Sprite.x 8+ DUP2 =Sprite.x |
|
327 |
+ ~Screen.width LTH2 ^$clear JNZ |
|
328 |
+ ( blink timer ) |
|
339 | 329 |
~timer #01 ADD =timer |
340 | 330 |
|
341 | 331 |
BRK |
342 | 332 |
|
343 |
-@center |
|
333 |
+@center ( -- ) |
|
344 | 334 |
|
345 |
- ( clear ) ~canvas.x1 #0002 SUB2 ~canvas.y1 #0002 SUB2 ~canvas.x2 #0002 ADD2 ~canvas.y2 #0002 ADD2 #00 ,fill-rect JSR2 |
|
335 |
+ ( clear old ) |
|
336 |
+ ~canvas.x1 #0002 SUB2 ~canvas.y1 #0002 SUB2 ~canvas.x2 #0002 ADD2 ~canvas.y2 #0002 ADD2 #00 ,fill-rect JSR2 |
|
346 | 337 |
|
347 | 338 |
,draw-background JSR2 |
348 | 339 |
|
... | ... |
@@ -351,40 +342,19 @@ BRK |
351 | 342 |
|
352 | 343 |
,fit-canvas JSR2 |
353 | 344 |
|
354 |
- ,draw-toolpane JSR2 |
|
355 |
- ,draw-pattpane JSR2 |
|
356 |
- ,draw-sizepane JSR2 |
|
357 |
- ,draw-viewpane JSR2 |
|
345 |
+ ,draw-foreground JSR2 |
|
358 | 346 |
|
359 | 347 |
RTN |
360 | 348 |
|
361 |
-@clear |
|
349 |
+@clear ( -- ) |
|
362 | 350 |
|
363 |
- #00 =document.namelength |
|
364 |
- |
|
365 |
- ,untitled_txt ,document.name |
|
366 |
- $rename |
|
367 |
- ( copy src->dst ) OVR2 OVR2 SWP2 PEK2 ROT ROT POK2 |
|
368 |
- ( incr dst ) ++ |
|
369 |
- ( incr src ) SWP2 ++ SWP2 |
|
370 |
- ( incr len ) ~document.namelength #01 ADD =document.namelength |
|
371 |
- OVR2 PEK2 #00 NEQ ^$rename JNZ |
|
372 |
- #00 ROT ROT POK2 POP2 |
|
373 |
- |
|
374 |
- ( erase old label ) |
|
375 |
- ~Screen.height #0010 SUB2 =Sprite.y |
|
376 |
- #0000 =Sprite.x |
|
377 |
- $erase |
|
378 |
- ( draw ) #00 =Sprite.color |
|
379 |
- ( incr ) ~Sprite.x ++ =Sprite.x |
|
380 |
- ~Sprite.x ~Screen.width LTH2 ^$erase JNZ |
|
381 |
- |
|
382 |
- ,draw-background JSR2 |
|
383 |
- |
|
384 |
- ( from ) ,data |
|
385 |
- ( to ) ~canvas.w ~canvas.h MUL2 #0008 MUL2 ,data ADD2 |
|
351 |
+ ( new label ) |
|
352 |
+ ,untitled_txt ,path.name ,strcpy JSR2 |
|
353 |
+ #00 =path.length |
|
354 |
+ ( erase data ) |
|
355 |
+ ,data FILESIZE ,data ADD2 |
|
386 | 356 |
$loop |
387 |
- OVR2 #00 ROT ROT POK2 |
|
357 |
+ ( write ) OVR2 #00 ROT ROT POK2 |
|
388 | 358 |
( incr ) SWP2 #0001 ADD2 SWP2 |
389 | 359 |
OVR2 OVR2 LTH2 ^$loop JNZ |
390 | 360 |
POP2 POP2 |
... | ... |
@@ -392,15 +362,15 @@ RTN |
392 | 362 |
|
393 | 363 |
RTN |
394 | 364 |
|
395 |
-@load-file ( path ) |
|
365 |
+@load-file ( path -- ) |
|
396 | 366 |
|
397 |
- =File.name ~canvas.w ~canvas.h MUL2 #0008 MUL2 =File.length ,data =File.load |
|
367 |
+ =File.name FILESIZE =File.length ,data =File.load |
|
398 | 368 |
|
399 | 369 |
RTN |
400 | 370 |
|
401 |
-@save-file |
|
371 |
+@save-file ( path -- ) |
|
402 | 372 |
|
403 |
- =File.name ~canvas.w ~canvas.h MUL2 #0008 MUL2 =File.length ,data =File.save |
|
373 |
+ =File.name FILESIZE =File.length ,data =File.save |
|
404 | 374 |
|
405 | 375 |
RTN |
406 | 376 |
|
... | ... |
@@ -413,7 +383,7 @@ RTN |
413 | 383 |
|
414 | 384 |
RTN |
415 | 385 |
|
416 |
-@paint-line ( x1 y1 x2 y2 ) |
|
386 |
+@paint-line ( x1 y1 x2 y2 -- ) |
|
417 | 387 |
|
418 | 388 |
( load ) =line.y1 =line.x1 =line.y2 =line.x2 |
419 | 389 |
|
... | ... |
@@ -446,14 +416,11 @@ RTN |
446 | 416 |
$end |
447 | 417 |
|
448 | 418 |
,draw-canvas JSR2 |
449 |
- ,draw-toolpane JSR2 |
|
450 |
- ,draw-pattpane JSR2 |
|
451 |
- ,draw-sizepane JSR2 |
|
452 |
- ,draw-viewpane JSR2 |
|
419 |
+ ,draw-foreground JSR2 |
|
453 | 420 |
|
454 | 421 |
RTN |
455 | 422 |
|
456 |
-@paint-rect ( x1 y1 x2 y2 ) |
|
423 |
+@paint-rect ( x1 y1 x2 y2 -- ) |
|
457 | 424 |
|
458 | 425 |
( load ) =rect.y2 =rect.x2 =rect.y1 =rect.x1 |
459 | 426 |
|
... | ... |
@@ -480,14 +447,11 @@ RTN |
480 | 447 |
~pt2.y ~rect.y2 LTS2 ^$ver JNZ |
481 | 448 |
|
482 | 449 |
,draw-canvas JSR2 |
483 |
- ,draw-toolpane JSR2 |
|
484 |
- ,draw-pattpane JSR2 |
|
485 |
- ,draw-sizepane JSR2 |
|
486 |
- ,draw-viewpane JSR2 |
|
450 |
+ ,draw-foreground JSR2 |
|
487 | 451 |
|
488 | 452 |
RTN |
489 | 453 |
|
490 |
-@paint-brush ( x y ) |
|
454 |
+@paint-brush ( x y -- ) |
|
491 | 455 |
|
492 | 456 |
#0003 SUB2 =pt0.y #0003 SUB2 =pt0.x ( cursor offset ) |
493 | 457 |
|
... | ... |
@@ -512,14 +476,11 @@ RTN |
512 | 476 |
~px.y #08 LTH ^$ver JNZ |
513 | 477 |
|
514 | 478 |
,draw-canvas JSR2 |
515 |
- ,draw-toolpane JSR2 |
|
516 |
- ,draw-pattpane JSR2 |
|
517 |
- ,draw-sizepane JSR2 |
|
518 |
- ,draw-viewpane JSR2 |
|
479 |
+ ,draw-foreground JSR2 |
|
519 | 480 |
|
520 | 481 |
RTN |
521 | 482 |
|
522 |
-@patternize |
|
483 |
+@patternize ( -- ) |
|
523 | 484 |
|
524 | 485 |
~brush.patt #00 NEQ ^$noplain JNZ |
525 | 486 |
#01 RTN |
... | ... |
@@ -576,7 +537,7 @@ RTN |
576 | 537 |
|
577 | 538 |
RTN |
578 | 539 |
|
579 |
-@add-pixel ( x y ) |
|
540 |
+@add-pixel ( x y -- ) |
|
580 | 541 |
|
581 | 542 |
=pt1.y =pt1.x |
582 | 543 |
( get tile addr ) ,data ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8* ~pt1.y MOD8 ADD2 ADD2 |
... | ... |
@@ -586,7 +547,7 @@ RTN |
586 | 547 |
|
587 | 548 |
RTN |
588 | 549 |
|
589 |
-@remove-pixel ( x y ) |
|
550 |
+@remove-pixel ( x y -- ) |
|
590 | 551 |
|
591 | 552 |
=pt1.y =pt1.x |
592 | 553 |
( get tile addr ) ,data ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8* ~pt1.y MOD8 ADD2 ADD2 |
... | ... |
@@ -598,18 +559,15 @@ RTN |
598 | 559 |
|
599 | 560 |
( Drawing ) |
600 | 561 |
|
601 |
-@redraw |
|
562 |
+@redraw ( -- ) |
|
602 | 563 |
|
603 | 564 |
,draw-background JSR2 |
604 | 565 |
,draw-canvas JSR2 |
605 |
- ,draw-toolpane JSR2 |
|
606 |
- ,draw-pattpane JSR2 |
|
607 |
- ,draw-sizepane JSR2 |
|
608 |
- ,draw-viewpane JSR2 |
|
566 |
+ ,draw-foreground JSR2 |
|
609 | 567 |
|
610 | 568 |
RTN |
611 | 569 |
|
612 |
-@draw-canvas |
|
570 |
+@draw-canvas ( -- ) |
|
613 | 571 |
|
614 | 572 |
~zoom.active #01 EQU ,draw-canvas-zoom JNZ2 |
615 | 573 |
|
... | ... |
@@ -627,7 +585,7 @@ RTN |
627 | 585 |
|
628 | 586 |
RTN |
629 | 587 |
|
630 |
-@draw-canvas-zoom |
|
588 |
+@draw-canvas-zoom ( -- ) |
|
631 | 589 |
|
632 | 590 |
~zoom.y =pt1.y |
633 | 591 |
~canvas.y1 =Sprite.y |
... | ... |
@@ -647,7 +605,7 @@ RTN |
647 | 605 |
|
648 | 606 |
RTN |
649 | 607 |
|
650 |
-@draw-cursor |
|
608 |
+@draw-cursor ( -- ) |
|
651 | 609 |
|
652 | 610 |
~cursor.x ~Mouse.x NEQ2 |
653 | 611 |
~cursor.y ~Mouse.y NEQ2 |
... | ... |
@@ -657,54 +615,41 @@ RTN |
657 | 615 |
#0101 EQU2 RTN? ( Return if unchanged ) |
658 | 616 |
|
659 | 617 |
,blank_icn =Sprite.addr |
660 |
- |
|
661 | 618 |
( clear brush size ) |
662 |
- ~cursor.x #0003 SUB2 =Sprite.x |
|
663 |
- ~cursor.y #0003 SUB2 =Sprite.y |
|
664 |
- #10 =Sprite.color |
|
665 |
- |
|
619 |
+ ~cursor.x #0003 SUB2 =Sprite.x ~cursor.y #0003 SUB2 =Sprite.y #10 =Sprite.color |
|
666 | 620 |
( clear last cursor ) |
667 |
- ~cursor.x =Sprite.x |
|
668 |
- ~cursor.y =Sprite.y |
|
669 |
- #10 =Sprite.color |
|
670 |
- |
|
621 |
+ ~cursor.x =Sprite.x ~cursor.y =Sprite.y #10 =Sprite.color |
|
671 | 622 |
( record cursor positions ) |
672 |
- ~Mouse.x =cursor.x |
|
673 |
- ~Mouse.y =cursor.y |
|
674 |
- |
|
623 |
+ ~Mouse.x =cursor.x ~Mouse.y =cursor.y |
|
675 | 624 |
( draw size cursor ) |
676 | 625 |
~brush.tool #01 NEQ ,$outside-canvas JNZ2 |
626 |
+ ( do not draw size when holding alt ) |
|
627 |
+ ~Controller #02 EQU ,$outside-canvas JNZ2 |
|
677 | 628 |
~Mouse.x CLN2r ~canvas.x1 GTH2 STH2r ~canvas.x2 LTH2 #0101 NEQ2 ,$outside-canvas JNZ2 |
678 | 629 |
~Mouse.y CLN2r ~canvas.y1 GTH2 STH2r ~canvas.y2 LTH2 #0101 NEQ2 ,$outside-canvas JNZ2 |
679 |
- ( do not draw size in toolpane ) |
|
680 |
- ~Mouse.x CLN2r ~toolpane.x1 GTH2 STH2r ~toolpane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~toolpane.y1 GTH2 STH2r ~toolpane.y2 LTH2 #0101 EQU2 #0101 EQU2 ,$outside-canvas JNZ2 |
|
681 |
- ~Mouse.x CLN2r ~sizepane.x1 GTH2 STH2r ~sizepane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~sizepane.y1 GTH2 STH2r ~sizepane.y2 LTH2 #0101 EQU2 #0101 EQU2 ,$outside-canvas JNZ2 |
|
682 |
- ~Mouse.x CLN2r ~pattpane.x1 GTH2 STH2r ~pattpane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~pattpane.y1 GTH2 STH2r ~pattpane.y2 LTH2 #0101 EQU2 #0101 EQU2 ,$outside-canvas JNZ2 |
|
683 |
- ( do not draw size when holding alt ) |
|
684 |
- ~Controller #02 EQU ^$outside-canvas JNZ |
|
685 |
- ~cursor.x #0003 SUB2 =Sprite.x |
|
686 |
- ~cursor.y #0003 SUB2 =Sprite.y |
|
630 |
+ ( do not draw size in toolpane ) |
|
631 |
+ ~Mouse.x CLN2r ~toolpane.x1 GTH2 STH2r ~toolpane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~toolpane.y1 GTH2 STH2r ~toolpane.y2 LTH2 #0101 EQU2 #0101 EQU2 ,$outside-canvas JNZ2 |
|
632 |
+ ~Mouse.x CLN2r ~sizepane.x1 GTH2 STH2r ~sizepane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~sizepane.y1 GTH2 STH2r ~sizepane.y2 LTH2 #0101 EQU2 #0101 EQU2 ,$outside-canvas JNZ2 |
|
633 |
+ ~Mouse.x CLN2r ~pattpane.x1 GTH2 STH2r ~pattpane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~pattpane.y1 GTH2 STH2r ~pattpane.y2 LTH2 #0101 EQU2 #0101 EQU2 ,$outside-canvas JNZ2 |
|
634 |
+ ~cursor.x #0003 SUB2 =Sprite.x ~cursor.y #0003 SUB2 =Sprite.y |
|
687 | 635 |
,brush_icns #00 ~brush.size 8* ADD2 =Sprite.addr |
688 | 636 |
#11 ~Mouse.state #02 MUL ADD =Sprite.color |
689 |
- ~Mouse.state #00 EQU ^$outside-canvas JNZ |
|
690 |
- RTN |
|
637 |
+ ~Mouse.state #00 EQU ^$outside-canvas JNZ RTN |
|
691 | 638 |
$outside-canvas |
692 |
- |
|
693 |
- ~cursor.x =Sprite.x |
|
694 |
- ~cursor.y =Sprite.y |
|
639 |
+ ( draw new cursor ) |
|
640 |
+ ~cursor.x =Sprite.x ~cursor.y =Sprite.y |
|
695 | 641 |
,pointers_icn #00 ~Controller #02 EQU 8* ADD2 =Sprite.addr |
696 | 642 |
#1f =Sprite.color |
697 | 643 |
|
698 | 644 |
RTN |
699 | 645 |
|
700 |
-@draw-toolpane |
|
646 |
+@draw-toolpane ( -- ) |
|
701 | 647 |
|
648 |
+ ( frame ) |
|
702 | 649 |
~toolpane.x1 -- ~toolpane.y1 -- ~toolpane.x2 ~toolpane.y2 #00 ,line-rect JSR2 |
703 | 650 |
~toolpane.x1 #0002 SUB2 ~toolpane.y1 #0002 SUB2 ~toolpane.x2 ~toolpane.y2 #01 ,line-rect JSR2 |
704 | 651 |
|
705 |
- ~toolpane.x1 =Sprite.x |
|
706 |
- ~toolpane.y1 =Sprite.y |
|
707 |
- ,tool_icns =Sprite.addr |
|
652 |
+ ~toolpane.x1 =Sprite.x ~toolpane.y1 =Sprite.y ,tool_icns =Sprite.addr |
|
708 | 653 |
|
709 | 654 |
$loop |
710 | 655 |
( draw ) #01 ~Sprite.x ~toolpane.x1 SUB2 8/ SWP POP ~brush.tool EQU #02 MUL ADD =Sprite.color |
... | ... |
@@ -716,18 +661,17 @@ RTN |
716 | 661 |
~Sprite.x #0008 SUB2 =Sprite.x |
717 | 662 |
,tool_icns #0028 ADD2 =Sprite.addr |
718 | 663 |
#01 #04 ~brush.tool EQU #02 MUL ADD =Sprite.color |
719 |
- $no-zoom |
|
664 |
+ $no-zoom |
|
720 | 665 |
|
721 | 666 |
RTN |
722 | 667 |
|
723 |
-@draw-pattpane |
|
668 |
+@draw-pattpane ( -- ) |
|
724 | 669 |
|
670 |
+ ( frame ) |
|
725 | 671 |
~pattpane.x1 -- ~pattpane.y1 -- ~pattpane.x2 ~pattpane.y2 #00 ,line-rect JSR2 |
726 | 672 |
~pattpane.x1 #0002 SUB2 ~pattpane.y1 #0002 SUB2 ~pattpane.x2 ~pattpane.y2 #01 ,line-rect JSR2 |
727 | 673 |
|
728 |
- ~pattpane.x1 =Sprite.x |
|
729 |
- ~pattpane.y1 =Sprite.y |
|
730 |
- ,patt_icns =Sprite.addr |
|
674 |
+ ~pattpane.x1 =Sprite.x ~pattpane.y1 =Sprite.y ,patt_icns =Sprite.addr |
|
731 | 675 |
|
732 | 676 |
$loop |
733 | 677 |
( draw ) #01 ~Sprite.x ~pattpane.x1 SUB2 8/ SWP POP ~brush.patt EQU #02 MUL ADD =Sprite.color |
... | ... |
@@ -737,14 +681,13 @@ RTN |
737 | 681 |
|
738 | 682 |
RTN |
739 | 683 |
|
740 |
-@draw-sizepane |
|
741 |
- |
|
684 |
+@draw-sizepane ( -- ) |
|
685 |
+ |
|
686 |
+ ( frame ) |
|
742 | 687 |
~sizepane.x1 -- ~sizepane.y1 -- ~sizepane.x2 ~sizepane.y2 #00 ,line-rect JSR2 |
743 | 688 |
~sizepane.x1 #0002 SUB2 ~sizepane.y1 #0002 SUB2 ~sizepane.x2 ~sizepane.y2 #01 ,line-rect JSR2 |
744 | 689 |
|
745 |
- ~sizepane.x1 =Sprite.x |
|
746 |
- ~sizepane.y1 =Sprite.y |
|
747 |
- ,size_icns =Sprite.addr |
|
690 |
+ ~sizepane.x1 =Sprite.x ~sizepane.y1 =Sprite.y ,size_icns =Sprite.addr |
|
748 | 691 |
|
749 | 692 |
$loop |
750 | 693 |
( draw ) #01 ~Sprite.x ~sizepane.x1 SUB2 8/ SWP POP ~brush.size EQU #02 MUL ADD =Sprite.color |
... | ... |
@@ -754,14 +697,13 @@ RTN |
754 | 697 |
|
755 | 698 |
RTN |
756 | 699 |
|
757 |
-@draw-viewpane |
|
758 |
- |
|
700 |
+@draw-viewpane ( -- ) |
|
701 |
+ |
|
702 |
+ ( frame ) |
|
759 | 703 |
~viewpane.x1 -- ~viewpane.y1 -- ~viewpane.x2 ~viewpane.y2 #00 ,line-rect JSR2 |
760 | 704 |
~viewpane.x1 #0002 SUB2 ~viewpane.y1 #0002 SUB2 ~viewpane.x2 ~viewpane.y2 #01 ,line-rect JSR2 |
761 | 705 |
|
762 |
- ~viewpane.x1 =Sprite.x |
|
763 |
- ~viewpane.y1 =Sprite.y |
|
764 |
- ,view_icns =Sprite.addr |
|
706 |
+ ~viewpane.x1 =Sprite.x ~viewpane.y1 =Sprite.y ,view_icns =Sprite.addr |
|
765 | 707 |
|
766 | 708 |
$loop |
767 | 709 |
( draw ) #01 =Sprite.color |
... | ... |
@@ -771,25 +713,21 @@ RTN |
771 | 713 |
|
772 | 714 |
RTN |
773 | 715 |
|
716 |
+@draw-foreground |
|
717 |
+ |
|
718 |
+ ,draw-toolpane JSR2 |
|
719 |
+ ,draw-pattpane JSR2 |
|
720 |
+ ,draw-sizepane JSR2 |
|
721 |
+ ,draw-viewpane JSR2 |
|
722 |
+ |
|
723 |
+RTN |
|
724 |
+ |
|
774 | 725 |
@draw-background |
775 | 726 |
|
776 | 727 |
( draw hor line ) |
777 |
- #0000 =Screen.x ~Screen.height #0002 DIV2 =Screen.y |
|
778 |
- #0000 ~Screen.width ( from/to ) |
|
779 |
- $draw-hor |
|
780 |
- ( draw ) #01 =Screen.color |
|
781 |
- ( incr ) SWP2 #0002 ADD2 DUP2 =Screen.x SWP2 |
|
782 |
- OVR2 OVR2 LTH2 ^$draw-hor JNZ |
|
783 |
- POP2 POP2 |
|
784 |
- |
|
728 |
+ #0000 ~Screen.width ~Screen.height #0002 DIV2 ,line-horizontal-dotted JSR2 |
|
785 | 729 |
( draw ver line ) |
786 |
- ~Screen.width #0002 DIV2 =Screen.x #0000 =Screen.y |
|
787 |
- #0000 ~Screen.height ( from/to ) |
|
788 |
- $draw-ver |
|
789 |
- ( draw ) #01 =Screen.color |
|
790 |
- ( incr ) SWP2 #0002 ADD2 DUP2 =Screen.y SWP2 |
|
791 |
- OVR2 OVR2 LTH2 ^$draw-ver JNZ |
|
792 |
- POP2 POP2 |
|
730 |
+ ~Screen.width #0002 DIV2 #0000 ~Screen.height ,line-vertical-dotted JSR2 |
|
793 | 731 |
|
794 | 732 |
( draw size ) |
795 | 733 |
#0010 =Sprite.y |
... | ... |
@@ -803,32 +741,26 @@ RTN |
803 | 741 |
( draw ) #01 =Sprite.color |
804 | 742 |
~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Sprite.addr |
805 | 743 |
( draw ) #01 =Sprite.color |
806 |
- |
|
807 | 744 |
( draw save/load/guides icons ) |
808 | 745 |
~Screen.height #0010 SUB2 =Sprite.y |
809 |
- |
|
810 | 746 |
~Screen.width #0020 SUB2 =Sprite.x |
811 | 747 |
,filestate_icn =Sprite.addr |
812 | 748 |
#01 =Sprite.color |
813 |
- |
|
814 | 749 |
~Sprite.x 8+ =Sprite.x |
815 | 750 |
,load_icn =Sprite.addr |
816 | 751 |
#01 =Sprite.color |
817 |
- |
|
818 | 752 |
~Sprite.x 8+ =Sprite.x |
819 | 753 |
,save_icn =Sprite.addr |
820 | 754 |
#01 =Sprite.color |
821 |
- |
|
822 |
- ( draw ) |
|
823 |
- |
|
755 |
+ ( filename ) |
|
824 | 756 |
#0008 =Sprite.x |
825 |
- ,document.name #01 ,draw-label JSR2 |
|
757 |
+ ,path.name #01 ,draw-label JSR2 |
|
826 | 758 |
|
827 | 759 |
RTN |
828 | 760 |
|
829 | 761 |
( Generics ) |
830 | 762 |
|
831 |
-@line-rect ( x1 y1 x2 y2 color ) |
|
763 |
+@line-rect ( x1 y1 x2 y2 color -- ) |
|
832 | 764 |
|
833 | 765 |
( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1 |
834 | 766 |
$hor |
... | ... |
@@ -845,7 +777,7 @@ RTN |
845 | 777 |
|
846 | 778 |
RTN |
847 | 779 |
|
848 |
-@fill-rect ( x1 y1 x2 y2 color ) |
|
780 |
+@fill-rect ( x1 y1 x2 y2 color -- ) |
|
849 | 781 |
|
850 | 782 |
( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1 |
851 | 783 |
$ver |
... | ... |
@@ -859,7 +791,7 @@ RTN |
859 | 791 |
|
860 | 792 |
RTN |
861 | 793 |
|
862 |
-@draw-label ( addr ) |
|
794 |
+@draw-label ( addr -- ) |
|
863 | 795 |
|
864 | 796 |
=color |
865 | 797 |
$loop |
... | ... |
@@ -872,6 +804,39 @@ RTN |
872 | 804 |
|
873 | 805 |
RTN |
874 | 806 |
|
807 |
+@line-horizontal-dotted ( x0 x1 y -- ) |
|
808 |
+ |
|
809 |
+ =Screen.y OVR2 =Screen.x |
|
810 |
+ $draw-hor |
|
811 |
+ ( draw ) #01 =Screen.color |
|
812 |
+ ( incr ) SWP2 #0002 ADD2 DUP2 =Screen.x SWP2 |
|
813 |
+ OVR2 OVR2 LTH2 ^$draw-hor JNZ |
|
814 |
+ POP2 POP2 |
|
815 |
+ |
|
816 |
+RTN |
|
817 |
+ |
|
818 |
+@line-vertical-dotted ( x y0 y1 -- ) |
|
819 |
+ |
|
820 |
+ STH2 SWP2 =Screen.x STH2r OVR2 =Screen.y |
|
821 |
+ $draw-ver |
|
822 |
+ ( draw ) #01 =Screen.color |
|
823 |
+ ( incr ) SWP2 #0002 ADD2 DUP2 =Screen.y SWP2 |
|
824 |
+ OVR2 OVR2 LTH2 ^$draw-ver JNZ |
|
825 |
+ POP2 POP2 |
|
826 |
+ |
|
827 |
+RTN |
|
828 |
+ |
|
829 |
+@strcpy ( src* dst* -- ) |
|
830 |
+ |
|
831 |
+ $loop |
|
832 |
+ ( copy src->dst ) OVR2 OVR2 SWP2 PEK2 ROT ROT POK2 |
|
833 |
+ ( incr dst ) ++ |
|
834 |
+ ( incr src ) SWP2 ++ SWP2 |
|
835 |
+ OVR2 PEK2 #00 NEQ ^$loop JNZ |
|
836 |
+ #00 ROT ROT POK2 POP2 |
|
837 |
+ |
|
838 |
+RTN |
|
839 |
+ |
|
875 | 840 |
@size_icns |
876 | 841 |
[ 0000 0010 0000 0000 ] |
877 | 842 |
[ 0000 1038 1000 0000 ] |