@@ 11,9 11,7 @@
TODO:
Save/load/rename
- Display file name
Edit file name
- Draw guides
)
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
@@ 37,6 35,7 @@
%INCR { SWP #01 + SWP }
%INCR2 { SWP2 #0001 ++ SWP2 }
%DECR2 { SWP2 #0001 -- SWP2 }
+%TOGGLE { DUP LDZ #00 = SWP STZ }
%GET-ITERATORS { SWP2k POP SWP POP }
%DEBUG { .Console/byte DEO #0a .Console/char DEO }
@@ 73,15 72,20 @@
|0000
-@settings [
+@state
+ &timer $1
+ &trap $1
+ &blink $1
+
+@settings
&depth $1
&color $1
&blending $1
&ratio $1
&tool $1
&focus $2
- &zoom $1 ]
-
+ &zoom $1
+
@frame [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 &width $2 &height $2 ]
( interface )
@@ 107,6 111,7 @@
;on-button .Controller/vector DEO2
;on-mouse .Mouse/vector DEO2
;on-transfer .File/vector DEO2
+ ;on-frame .Screen/vector DEO2
( set defaults )
HOR TOS #0008 ** .frame/width STZ2
@@ 132,12 137,25 @@
.frame/x1 LDZ2 #0090 ++ .frame/y1 LDZ2 #0020 #0028 SIZE-TO-RECT ;zoomview SET-RECT
.frame/x1 LDZ2 #00c0 ++ .frame/y1 LDZ2 #0048 #0020 SIZE-TO-RECT ;dataview SET-RECT
- ;filepath .File/name DEO2 #2000 .File/length DEO2 BANK .File/load DEO2
-
+ ;load-file JSR2
;redraw JSR2
BRK
+@on-frame ( -> )
+
+ .state/trap LDZ #00 ! #01 JCN [ BRK ]
+
+ ( incr ) .state/timer LDZ #01 + DUP .state/timer STZ
+
+ #08 ! ,&no-toggle JCN
+ .state/blink TOGGLE
+ #23 .state/blink LDZ #09 * + ;draw-filepath JSR2
+ #00 .state/timer STZ
+ &no-toggle
+
+BRK
+
@on-transfer ( -> )
;redraw JSR2
@@ 148,6 166,8 @@ BRK
.Controller/key DEI .Controller/button DEI #0000 !! #01 JCN [ BRK ]
+ .state/trap LDZ #01 = ;on-button-trap JCN2
+
.Controller/key DEI
DUP #31 ! ,&no-1 JCN
( color ) #00 .settings/color STZ ;draw-toolview JSR2 &no-1
@@ 162,7 182,7 @@ BRK
DUP #0d ! ,&no-insert JCN
( insert ) .settings/focus LDZ2 ;op-shift-memory-right JSR2 ;redraw JSR2 &no-insert
DUP #20 ! ,&no-zoom JCN
- ( zoom ) .settings/zoom LDZ #00 = .settings/zoom STZ ;redraw JSR2 &no-zoom
+ ( zoom ) .settings/zoom TOGGLE ;redraw JSR2 &no-zoom
DUP #71 ! ,&no-tool0 JCN
( tool ) #00 .settings/tool STZ ;redraw JSR2 &no-tool0
DUP #77 ! ,&no-tool1 JCN
@@ 192,6 212,12 @@ BRK
BRK
+@on-button-trap ( -> )
+
+ .Controller/key DEI DEBUG
+
+BRK
+
@on-mouse ( -> )
;draw-cursor JSR2
@@ 259,6 285,19 @@ BRK
.Mouse/x DEI2 .toolview/x1 LDZ2 -- #0008 // TOB
+ DUP HOR SWP - #01 ! ,&no-save JCN
+ ;save-file JSR2
+ &no-save
+ DUP HOR SWP - #02 ! ,&no-load JCN
+ ;load-file JSR2
+ &no-load
+ DUP HOR SWP - #03 ! ,&no-name JCN
+ &no-name
+ DUP #09 > OVR HOR SWP - #04 > #0101 !! ,&no-rename JCN
+ .state/trap TOGGLE
+ #00 .state/blink STZ
+ #23 ;draw-filepath JSR2
+ &no-rename
DUP #02 > ,&no-color JCN
DUP #01 + .settings/color STZ
;draw-colorview JSR2
@@ 270,16 309,10 @@ BRK
;draw-toolview JSR2 POP BRK
&no-tool
DUP #08 ! ,&no-zoom JCN
- .settings/zoom LDZ #00 = .settings/zoom STZ
+ .settings/zoom LDZ TOGGLE
;draw-tileview JSR2
;draw-toolview JSR2
&no-zoom
- DUP HOR SWP - #01 ! ,&no-save JCN
- #aa DEBUG &no-save
- DUP HOR SWP - #02 ! ,&no-load JCN
- #bb DEBUG &no-load
- DUP HOR SWP - #03 ! ,&no-name JCN
- #cc DEBUG &no-name
POP
&end
@@ 645,18 678,6 @@ RTN
;zoom-icns [ .settings/zoom LDZ TOS #0008 ** ++ ] .Screen/addr DEO2
#23 .Screen/color DEO
- ( filepath )
- .Screen/x DEI2 #0010 ++ .Screen/x DEO2
-
- ;filepath
- &loop
- DUP2 LDA TOS #0020 -- #0008 ** ;font ++ .Screen/addr DEO2
- #22 .Screen/color DEO
- .Screen/x DEI2 #0008 ++ .Screen/x DEO2
- #0001 ++
- LDAk #00 ! ,&loop JCN
- POP2
-
( file i/o )
.toolview/x2 LDZ2 #0008 -- .Screen/x DEO2
;save-icn .Screen/addr DEO2
@@ 668,6 689,9 @@ RTN
;name-icn .Screen/addr DEO2
#21 .Screen/color DEO
+ ( filepath )
+ #23 ;draw-filepath JSR2
+
RTN
@draw-blendview ( -- )
@@ 692,6 716,25 @@ RTN
RTN
+@draw-filepath ( color -- )
+
+ STH
+
+ .toolview/x1 LDZ2 #0040 ++ .Screen/x DEO2
+ .toolview/y1 LDZ2 .Screen/y DEO2
+
+ ;filepath
+ &loop
+ DUP2 LDA TOS #0020 -- #0008 ** ;font ++ .Screen/addr DEO2
+ STHkr .Screen/color DEO
+ .Screen/x DEI2 #0008 ++ .Screen/x DEO2
+ #0001 ++
+ LDAk #00 ! ,&loop JCN
+ POP2
+ POPr
+
+RTN
+
@draw-preview ( -- )
( value )
@@ 878,6 921,22 @@ RTN
RTN
+@load-file ( name* -- )
+
+ ;filepath .File/name DEO2
+ #2000 .File/length DEO2
+ BANK .File/load DEO2
+
+RTN
+
+@save-file ( name* -- )
+
+ ;filepath .File/name DEO2
+ #2000 .File/length DEO2
+ BANK .File/save DEO2
+
+RTN
+
@within-rect ( x* y* rect -- flag )
STH
@@ 980,4 1039,4 @@ RTN
0008 0808 0808 0800 0030 1008 0810 3000
0000 0032 4c00 0000 3c42 99a1 a199 423c
@filepath
- "example.chr $1
+ "example2.chr $1