Renamed PEK/POK to LDZ/STZ

This commit is contained in:
neauoire 2021-05-11 11:14:52 -07:00
parent 8630028e97
commit a206ed0b10
28 changed files with 1452 additions and 1452 deletions

View File

@ -18,10 +18,10 @@ contexts:
- match: '\.(\S+)\sDEO' - match: '\.(\S+)\sDEO'
scope: constant.numeric scope: constant.numeric
pop: true pop: true
- match: '\.(\S+)\sPOK2' - match: '\.(\S+)\sSTZ2'
scope: constant.numeric scope: constant.numeric
pop: true pop: true
- match: '\.(\S+)\sPOK' - match: '\.(\S+)\sSTZ'
scope: constant.numeric scope: constant.numeric
pop: true pop: true
- match: '\.(\S+)\sLDA2' - match: '\.(\S+)\sLDA2'
@ -37,10 +37,10 @@ contexts:
- match: '\.(\S+)\sDEI' - match: '\.(\S+)\sDEI'
scope: entity.name.type.typedef scope: entity.name.type.typedef
pop: true pop: true
- match: '\.(\S+)\sPEK2' - match: '\.(\S+)\sLDZ2'
scope: entity.name.type.typedef scope: entity.name.type.typedef
pop: true pop: true
- match: '\.(\S+)\sPEK' - match: '\.(\S+)\sLDZ'
scope: entity.name.type.typedef scope: entity.name.type.typedef
pop: true pop: true
- match: '\.(\S+)\sSTA2' - match: '\.(\S+)\sSTA2'

View File

@ -7,10 +7,10 @@ import P, R, S, C, Ct, Cp, V from require 'lpeg'
local labels, filename local labels, filename
opcode_translate = opcode_translate =
PEK2: 'LDA' LDZ2: 'LDA'
POK2: 'STA' STZ2: 'STA'
LDR: 'PEK2' LDR: 'LDZ2'
STR: 'POK2' STR: 'STZ2'
LDR2: 'LDA2' LDR2: 'LDA2'
STR2: 'STA2' STR2: 'STA2'
@ -26,7 +26,7 @@ grammar = P {
r, w = if var\sub(1, 1) == var\sub(1, 1)\upper! r, w = if var\sub(1, 1) == var\sub(1, 1)\upper!
' DEI', ' DEO' ' DEI', ' DEO'
else else
' PEK', ' POK' ' LDZ', ' STZ'
for i = 7, select('#', ...), 6 for i = 7, select('#', ...), 6
k = select i, ... k = select i, ...
rr, ww = if '2' == select i + 3, ... rr, ww = if '2' == select i + 3, ...

View File

@ -41,8 +41,8 @@
;on-mouse .Mouse/vector DEO2 ;on-mouse .Mouse/vector DEO2
( find center ) ( find center )
.Screen/width DEI2 2/ .center/x POK2 .Screen/width DEI2 2/ .center/x STZ2
.Screen/height DEI2 2/ .center/y POK2 .Screen/height DEI2 2/ .center/y STZ2
( background ) ( background )
;tiles ;cover-pattern JSR2 ;tiles ;cover-pattern JSR2
@ -53,9 +53,9 @@ BRK
@on-frame ( -> ) @on-frame ( -> )
( only draw once per second ) ( only draw once per second )
.DateTime/second DEI .last PEK NEQ #01 JCN [ BRK ] .DateTime/second DEI .last LDZ NEQ #01 JCN [ BRK ]
.DateTime/second DEI .last POK .DateTime/second DEI .last STZ
;redraw JSR2 ;redraw JSR2
@ -66,8 +66,8 @@ BRK
;draw-cursor JSR2 ;draw-cursor JSR2
.Mouse/state DEI #00 EQU ,&no-touch JCN .Mouse/state DEI #00 EQU ,&no-touch JCN
( incr ) .style PEK INC #03 MOD .style POK ( incr ) .style LDZ INC #03 MOD .style STZ
( bg ) ;tiles .style PEK #10 MUL TOS ADD2 ;cover-pattern JSR2 ( bg ) ;tiles .style LDZ #10 MUL TOS ADD2 ;cover-pattern JSR2
( fg ) ;redraw JSR2 ( fg ) ;redraw JSR2
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
&no-touch &no-touch
@ -77,26 +77,26 @@ BRK
@redraw ( -- ) @redraw ( -- )
( hrs ) ( hrs )
[ .center/x PEK2 #0018 SUB2 ] [ .center/x LDZ2 #0018 SUB2 ]
[ .center/y PEK2 #0048 SUB2 ] [ .center/y LDZ2 #0048 SUB2 ]
.DateTime/hour DEI #0a DIV ;draw-number JSR2 .DateTime/hour DEI #0a DIV ;draw-number JSR2
[ .center/x PEK2 #0008 ADD2 ] [ .center/x LDZ2 #0008 ADD2 ]
[ .center/y PEK2 #0048 SUB2 ] [ .center/y LDZ2 #0048 SUB2 ]
.DateTime/hour DEI #0a MOD ;draw-number JSR2 .DateTime/hour DEI #0a MOD ;draw-number JSR2
( min ) ( min )
[ .center/x PEK2 #0018 SUB2 ] [ .center/x LDZ2 #0018 SUB2 ]
[ .center/y PEK2 #0018 SUB2 ] [ .center/y LDZ2 #0018 SUB2 ]
.DateTime/minute DEI #0a DIV ;draw-number JSR2 .DateTime/minute DEI #0a DIV ;draw-number JSR2
[ .center/x PEK2 #0008 ADD2 ] [ .center/x LDZ2 #0008 ADD2 ]
[ .center/y PEK2 #0018 SUB2 ] [ .center/y LDZ2 #0018 SUB2 ]
.DateTime/minute DEI #0a MOD ;draw-number JSR2 .DateTime/minute DEI #0a MOD ;draw-number JSR2
( sec ) ( sec )
[ .center/x PEK2 #0018 SUB2 ] [ .center/x LDZ2 #0018 SUB2 ]
[ .center/y PEK2 #0018 ADD2 ] [ .center/y LDZ2 #0018 ADD2 ]
.DateTime/second DEI #0a DIV .DateTime/second DEI #0a DIV
;draw-number JSR2 ;draw-number JSR2
[ .center/x PEK2 #0008 ADD2 ] [ .center/x LDZ2 #0008 ADD2 ]
[ .center/y PEK2 #0018 ADD2 ] [ .center/y LDZ2 #0018 ADD2 ]
.DateTime/second DEI #0a MOD .DateTime/second DEI #0a MOD
;draw-number JSR2 ;draw-number JSR2
@ -105,15 +105,15 @@ RTN
@draw-number ( x y n -- ) @draw-number ( x y n -- )
STH STH
( save pos ) .anchor/y POK2 .anchor/x POK2 ( save pos ) .anchor/y STZ2 .anchor/x STZ2
#00 #0f #00 #0f
&loop &loop
( save-x ) OVR #03 MOD TOS #0008 MUL2 .anchor/x PEK2 ADD2 .Screen/x DEO2 ( save-x ) OVR #03 MOD TOS #0008 MUL2 .anchor/x LDZ2 ADD2 .Screen/x DEO2
( save-y ) OVR #03 DIV TOS #0008 MUL2 .anchor/y PEK2 ADD2 .Screen/y DEO2 ( save-y ) OVR #03 DIV TOS #0008 MUL2 .anchor/y LDZ2 ADD2 .Screen/y DEO2
( get digit* ) OVR DUPr STHr #02 MUL TOS ;digits ADD2 LDA2 ( get digit* ) OVR DUPr STHr #02 MUL TOS ;digits ADD2 LDA2
( get bit ) ROT #0e SWP SUB TOS SFT2 #0001 AND2 ( get bit ) ROT #0e SWP SUB TOS SFT2 #0001 AND2
( set tile ) #0008 MUL2 ;tiles ADD2 ( set tile ) #0008 MUL2 ;tiles ADD2
( set style ) .style PEK #10 MUL TOS ADD2 ( set style ) .style LDZ #10 MUL TOS ADD2
.Screen/addr DEO2 .Screen/addr DEO2
( draw ) #21 .Screen/color DEO ( draw ) #21 .Screen/color DEO
( incr ) SWP INC SWP ( incr ) SWP INC SWP
@ -146,15 +146,15 @@ RTN
( clear last cursor ) ( clear last cursor )
;cursor .Screen/addr DEO2 ;cursor .Screen/addr DEO2
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x POK2 .Mouse/x DEI2 .pointer/x STZ2
.Mouse/y DEI2 .pointer/y POK2 .Mouse/y DEI2 .pointer/y STZ2
( draw new cursor ) ( draw new cursor )
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
( colorize on state ) ( colorize on state )
#31 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/color DEO #31 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/color DEO

View File

@ -81,53 +81,53 @@
#1000 .Audio3/length DEO2 #1000 .Audio3/length DEO2
( defaults ) ( defaults )
#01 .modes POK #01 .modes STZ
#01 .piano/octave POK #01 .piano/octave STZ
( find center ) ( find center )
.Screen/width DEI2 #0002 // .center/x POK2 .Screen/width DEI2 #0002 // .center/x STZ2
.Screen/height DEI2 #0002 // .center/y POK2 .Screen/height DEI2 #0002 // .center/y STZ2
( place frame ) ( place frame )
.center/x PEK2 PAD-WIDTH #0003 ** -- #0010 -- .frame/x1 POK2 .center/x LDZ2 PAD-WIDTH #0003 ** -- #0010 -- .frame/x1 STZ2
.center/y PEK2 #0050 -- .frame/y1 POK2 .center/y LDZ2 #0050 -- .frame/y1 STZ2
.center/x PEK2 PAD-WIDTH #0003 ** ++ #0010 ++ .frame/x2 POK2 .center/x LDZ2 PAD-WIDTH #0003 ** ++ #0010 ++ .frame/x2 STZ2
.frame/y1 PEK2 PAD-HEIGHT #0004 ** ++ #0028 ++ .frame/y2 POK2 .frame/y1 LDZ2 PAD-HEIGHT #0004 ** ++ #0028 ++ .frame/y2 STZ2
( place pad-view ) ( place pad-view )
.frame/x1 PEK2 .pad-view/x1 POK2 .frame/x1 LDZ2 .pad-view/x1 STZ2
.frame/y1 PEK2 .pad-view/y1 POK2 .frame/y1 LDZ2 .pad-view/y1 STZ2
.pad-view/x1 PEK2 #0004 PAD-WIDTH ** ++ .pad-view/x2 POK2 .pad-view/x1 LDZ2 #0004 PAD-WIDTH ** ++ .pad-view/x2 STZ2
.pad-view/y1 PEK2 #0004 PAD-HEIGHT ** ++ .pad-view/y2 POK2 .pad-view/y1 LDZ2 #0004 PAD-HEIGHT ** ++ .pad-view/y2 STZ2
( place mix-view ) ( place mix-view )
.pad-view/x2 PEK2 #0006 ++ .mix-view/x1 POK2 .pad-view/x2 LDZ2 #0006 ++ .mix-view/x1 STZ2
.pad-view/y1 PEK2 .mix-view/y1 POK2 .pad-view/y1 LDZ2 .mix-view/y1 STZ2
.mix-view/x1 PEK2 #007a ++ .mix-view/x2 POK2 .mix-view/x1 LDZ2 #007a ++ .mix-view/x2 STZ2
.pad-view/y2 PEK2 .mix-view/y2 POK2 .pad-view/y2 LDZ2 .mix-view/y2 STZ2
( place oct-view ) ( place oct-view )
.frame/x1 PEK2 .oct-view/x1 POK2 .frame/x1 LDZ2 .oct-view/x1 STZ2
.mix-view/y2 PEK2 #0004 ++ .oct-view/y1 POK2 .mix-view/y2 LDZ2 #0004 ++ .oct-view/y1 STZ2
.oct-view/x1 PEK2 #0050 ++ .oct-view/x2 POK2 .oct-view/x1 LDZ2 #0050 ++ .oct-view/x2 STZ2
.oct-view/y1 PEK2 #0018 ++ .oct-view/y2 POK2 .oct-view/y1 LDZ2 #0018 ++ .oct-view/y2 STZ2
( place wav-view ) ( place wav-view )
.oct-view/x2 PEK2 .wav-view/x1 POK2 .oct-view/x2 LDZ2 .wav-view/x1 STZ2
.mix-view/y2 PEK2 #0004 ++ .wav-view/y1 POK2 .mix-view/y2 LDZ2 #0004 ++ .wav-view/y1 STZ2
.frame/x2 PEK2 .wav-view/x2 POK2 .frame/x2 LDZ2 .wav-view/x2 STZ2
.wav-view/y1 PEK2 #0020 ++ .wav-view/y2 POK2 .wav-view/y1 LDZ2 #0020 ++ .wav-view/y2 STZ2
( draw outlines ) ( draw outlines )
.mix-view/x1 PEK2 #0004 -- .mix-view/x1 LDZ2 #0004 --
.mix-view/y1 PEK2 #0000 -- .mix-view/y1 LDZ2 #0000 --
.mix-view/x2 PEK2 #0002 -- .mix-view/x2 LDZ2 #0002 --
.mix-view/y2 PEK2 #0002 -- .mix-view/y2 LDZ2 #0002 --
#01 ;line-rect JSR2 #01 ;line-rect JSR2
.wav-view/x1 PEK2 #0000 -- .wav-view/x1 LDZ2 #0000 --
.wav-view/y1 PEK2 #0002 -- .wav-view/y1 LDZ2 #0002 --
.wav-view/x2 PEK2 #0002 -- .wav-view/x2 LDZ2 #0002 --
.wav-view/y2 PEK2 #0002 ++ .wav-view/y2 LDZ2 #0002 ++
#01 ;line-rect JSR2 #01 ;line-rect JSR2
( initial draw ) ( initial draw )
@ -155,8 +155,8 @@ BRK
#00 #04 #00 #04
&loop &loop
OVR STH OVR STH
( x ) .mix-view/x1 PEK2 #0074 ++ ( x ) .mix-view/x1 LDZ2 #0074 ++
( y ) .mix-view/y1 PEK2 PAD-HEIGHT DUPr STHr TOS ** ++ #0002 ++ ( y ) .mix-view/y1 LDZ2 PAD-HEIGHT DUPr STHr TOS ** ++ #0002 ++
( output ) .Audio0/output STHr #10 * + DEI ( output ) .Audio0/output STHr #10 * + DEI
;draw-monitor JSR2 ;draw-monitor JSR2
( incr ) SWP #01 + SWP ( incr ) SWP #01 + SWP
@ -171,16 +171,16 @@ BRK
.Mouse/state DEI #00 ! #01 JCN [ BRK ] .Mouse/state DEI #00 ! #01 JCN [ BRK ]
.Mouse/x DEI2 DUP2 .pad-view/x1 PEK2 >> ROT ROT .pad-view/x2 PEK2 #0001 ++ << #0101 == .Mouse/x DEI2 DUP2 .pad-view/x1 LDZ2 >> ROT ROT .pad-view/x2 LDZ2 #0001 ++ << #0101 ==
.Mouse/y DEI2 DUP2 .pad-view/y1 PEK2 >> ROT ROT .pad-view/y2 PEK2 << #0101 == .Mouse/y DEI2 DUP2 .pad-view/y1 LDZ2 >> ROT ROT .pad-view/y2 LDZ2 << #0101 ==
#0101 == ;on-touch-pad JCN2 #0101 == ;on-touch-pad JCN2
.Mouse/x DEI2 DUP2 .mix-view/x1 PEK2 >> ROT ROT .mix-view/x2 PEK2 #0001 ++ << #0101 == .Mouse/x DEI2 DUP2 .mix-view/x1 LDZ2 >> ROT ROT .mix-view/x2 LDZ2 #0001 ++ << #0101 ==
.Mouse/y DEI2 DUP2 .mix-view/y1 PEK2 >> ROT ROT .mix-view/y2 PEK2 << #0101 == .Mouse/y DEI2 DUP2 .mix-view/y1 LDZ2 >> ROT ROT .mix-view/y2 LDZ2 << #0101 ==
#0101 == ;on-touch-mix JCN2 #0101 == ;on-touch-mix JCN2
.Mouse/x DEI2 DUP2 .oct-view/x1 PEK2 >> ROT ROT .oct-view/x2 PEK2 #0001 ++ << #0101 == .Mouse/x DEI2 DUP2 .oct-view/x1 LDZ2 >> ROT ROT .oct-view/x2 LDZ2 #0001 ++ << #0101 ==
.Mouse/y DEI2 DUP2 .oct-view/y1 PEK2 >> ROT ROT .oct-view/y2 PEK2 << #0101 == .Mouse/y DEI2 DUP2 .oct-view/y1 LDZ2 >> ROT ROT .oct-view/y2 LDZ2 << #0101 ==
#0101 == ;on-touch-oct JCN2 #0101 == ;on-touch-oct JCN2
BRK BRK
@ -229,8 +229,8 @@ BRK
@on-touch-pad ( -> ) @on-touch-pad ( -> )
( x ) .Mouse/x DEI2 .pad-view/x1 PEK2 -- PAD-WIDTH // TOB ( x ) .Mouse/x DEI2 .pad-view/x1 LDZ2 -- PAD-WIDTH // TOB
( y ) .Mouse/y DEI2 .pad-view/y1 PEK2 -- PAD-HEIGHT // TOB #04 * + ( y ) .Mouse/y DEI2 .pad-view/y1 LDZ2 -- PAD-HEIGHT // TOB #04 * +
DUP SWP ;play-pad JSR2 DUP SWP ;play-pad JSR2
@ -242,8 +242,8 @@ BRK
@on-touch-mix ( -> ) @on-touch-mix ( -> )
( channel ) .Mouse/y DEI2 .mix-view/y1 PEK2 -- PAD-HEIGHT // TOB STH ( channel ) .Mouse/y DEI2 .mix-view/y1 LDZ2 -- PAD-HEIGHT // TOB STH
( knob ) .Mouse/x DEI2 .mix-view/x1 PEK2 -- #0010 // TOB ( knob ) .Mouse/x DEI2 .mix-view/x1 LDZ2 -- #0010 // TOB
( adsr ) ( adsr )
DUP #00 ! ,&no-a JCN DUP #00 ! ,&no-a JCN
.Audio0/adsr [ DUPr STHr #10 * + ] DEI .Audio0/adsr [ DUPr STHr #10 * + ] DEI
@ -263,9 +263,9 @@ BRK
.Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEO &no-r .Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEO &no-r
( modes ) ( modes )
DUP #04 ! ,&no-repeat JCN DUP #04 ! ,&no-repeat JCN
.modes [ DUPr STHr + ] PEK .modes [ DUPr STHr + ] LDZ
#00 = #00 =
.modes [ DUPr STHr + ] POK &no-repeat .modes [ DUPr STHr + ] STZ &no-repeat
( volume ) ( volume )
DUP #05 ! ,&no-left JCN DUP #05 ! ,&no-left JCN
.Audio0/volume [ DUPr STHr #10 * + ] DEI .Audio0/volume [ DUPr STHr #10 * + ] DEI
@ -287,26 +287,26 @@ BRK
@on-touch-oct ( -> ) @on-touch-oct ( -> )
.Mouse/x DEI2 .oct-view/x1 PEK2 -- #0008 // TOB #08 ! ,&no-mod JCN .Mouse/x DEI2 .oct-view/x1 LDZ2 -- #0008 // TOB #08 ! ,&no-mod JCN
.Mouse/y DEI2 .oct-view/y1 PEK2 -- #0008 // TOB .Mouse/y DEI2 .oct-view/y1 LDZ2 -- #0008 // TOB
DUP #00 ! ,&no-incr JCN DUP #00 ! ,&no-incr JCN
.piano/octave PEK #01 + .piano/octave POK &no-incr .piano/octave LDZ #01 + .piano/octave STZ &no-incr
DUP #02 ! ,&no-decr JCN DUP #02 ! ,&no-decr JCN
.piano/octave PEK #01 - .piano/octave POK &no-decr .piano/octave LDZ #01 - .piano/octave STZ &no-decr
POP POP
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-octave JSR2 ;draw-octave JSR2
BRK BRK
&no-mod &no-mod
.Mouse/x DEI2 .oct-view/x1 PEK2 -- #0008 // TOB #06 GTH ,&no-key JCN .Mouse/x DEI2 .oct-view/x1 LDZ2 -- #0008 // TOB #06 GTH ,&no-key JCN
.Mouse/x DEI2 .oct-view/x1 PEK2 -- #0008 // .Mouse/x DEI2 .oct-view/x1 LDZ2 -- #0008 //
( set pitch of pad ) ( set pitch of pad )
DUP2 ;notes ++ LDA .pads/last PEK SWP .piano/octave PEK #02 - #0c * + DUP2 ;notes ++ LDA .pads/last LDZ SWP .piano/octave LDZ #02 - #0c * +
( save ) SWP TOS ;pad-pitch ++ STA ( save ) SWP TOS ;pad-pitch ++ STA
( record last note ) ( record last note )
TOB .piano/last POK TOB .piano/last STZ
.pads/last PEK ;play-pad JSR2 .pads/last LDZ ;play-pad JSR2
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-octave JSR2 ;draw-octave JSR2
&no-key &no-key
@ -316,8 +316,8 @@ BRK
@play-pad ( note pad -- ) @play-pad ( note pad -- )
( unselect last ) ( unselect last )
.pads/last PEK #01 ;draw-pad JSR2 .pads/last LDZ #01 ;draw-pad JSR2
DUP .pads/last POK DUP .pads/last STZ
( highlight ) ( highlight )
DUP #02 ;draw-pad JSR2 DUP #02 ;draw-pad JSR2
( addr ) ( addr )
@ -325,7 +325,7 @@ BRK
DUP #04 / #10 * .Audio0/addr + STH2r ROT DEO2 DUP #04 / #10 * .Audio0/addr + STH2r ROT DEO2
( pitch ) ( pitch )
DUP TOS ;pad-pitch ++ LDA STH DUP TOS ;pad-pitch ++ LDA STH
DUP #04 / .modes + PEK #00 = #80 * STH ADDr DUP #04 / .modes + LDZ #00 = #80 * STH ADDr
DUP #04 / #10 * .Audio0/pitch + STHr SWP DEO DUP #04 / #10 * .Audio0/pitch + STHr SWP DEO
#04 / ;draw-mixer JSR2 #04 / ;draw-mixer JSR2
@ -337,25 +337,25 @@ RTN
#02 * #00 SWP ;pad-addr ++ LDA2 STH2 #02 * #00 SWP ;pad-addr ++ LDA2 STH2
( clear ) ( clear )
.wav-view/x1 PEK2 #0002 ++ .wav-view/x1 LDZ2 #0002 ++
.wav-view/y1 PEK2 .wav-view/y1 LDZ2
.wav-view/x2 PEK2 #0002 -- .wav-view/x2 LDZ2 #0002 --
.wav-view/y2 PEK2 .wav-view/y2 LDZ2
#00 ;fill-rect JSR2 #00 ;fill-rect JSR2
.wav-view/x1 PEK2 #0002 ++ .Screen/x DEO2 .wav-view/x1 LDZ2 #0002 ++ .Screen/x DEO2
( waveform ) ( waveform )
#00 #e8 #00 #e8
&loop &loop
( dotted line ) ( dotted line )
OVR #01 AND ,&no-dot JCN OVR #01 AND ,&no-dot JCN
.wav-view/y1 PEK2 #0010 ++ .Screen/y DEO2 .wav-view/y1 LDZ2 #0010 ++ .Screen/y DEO2
#01 .Screen/color DEO #01 .Screen/color DEO
&no-dot &no-dot
OVR TOS #0010 ** [ DUP2r STH2r ] ++ LDA OVR TOS #0010 ** [ DUP2r STH2r ] ++ LDA
#02 / #02 /
TOS #0004 // .wav-view/y1 PEK2 ++ .Screen/y DEO2 TOS #0004 // .wav-view/y1 LDZ2 ++ .Screen/y DEO2
.Screen/x DEI2 #0001 ++ .Screen/x DEO2 .Screen/x DEI2 #0001 ++ .Screen/x DEO2
( draw ) #02 .Screen/color DEO ( draw ) #02 .Screen/color DEO
( incr ) SWP #01 + SWP ( incr ) SWP #01 + SWP
@ -367,24 +367,24 @@ RTN
@draw-mixer ( mixer -- ) @draw-mixer ( mixer -- )
DUP STH #00 SWP PAD-HEIGHT ** .mix-view/y1 PEK2 ++ #0003 ++ DUP STH #00 SWP PAD-HEIGHT ** .mix-view/y1 LDZ2 ++ #0003 ++
( adsr ) ( adsr )
DUP2 .mix-view/x1 PEK2 SWP2 DUP2 .mix-view/x1 LDZ2 SWP2
.Audio0/adsr [ DUPr STHr #10 * + ] DEI #04 SFT ;draw-knob JSR2 .Audio0/adsr [ DUPr STHr #10 * + ] DEI #04 SFT ;draw-knob JSR2
DUP2 .mix-view/x1 PEK2 #0010 ++ SWP2 DUP2 .mix-view/x1 LDZ2 #0010 ++ SWP2
.Audio0/adsr [ DUPr STHr #10 * + ] DEI #0f AND ;draw-knob JSR2 .Audio0/adsr [ DUPr STHr #10 * + ] DEI #0f AND ;draw-knob JSR2
DUP2 .mix-view/x1 PEK2 #0020 ++ SWP2 DUP2 .mix-view/x1 LDZ2 #0020 ++ SWP2
.Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEI #04 SFT ;draw-knob JSR2 .Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEI #04 SFT ;draw-knob JSR2
DUP2 .mix-view/x1 PEK2 #0030 ++ SWP2 DUP2 .mix-view/x1 LDZ2 #0030 ++ SWP2
.Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEI #0f AND ;draw-knob JSR2 .Audio0/adsr [ DUPr STHr #10 * + ] #01 + DEI #0f AND ;draw-knob JSR2
( once/repeat ) ( once/repeat )
DUP2 .mix-view/x1 PEK2 #0040 ++ SWP2 DUP2 .mix-view/x1 LDZ2 #0040 ++ SWP2
.modes [ DUPr STHr + ] PEK ;draw-switch JSR2 .modes [ DUPr STHr + ] LDZ ;draw-switch JSR2
( volume ) ( volume )
DUP2 .mix-view/x1 PEK2 #0050 ++ SWP2 DUP2 .mix-view/x1 LDZ2 #0050 ++ SWP2
.Audio0/volume [ DUPr STHr #10 * + ] DEI #04 SFT ;draw-knob JSR2 .Audio0/volume [ DUPr STHr #10 * + ] DEI #04 SFT ;draw-knob JSR2
DUP2 .mix-view/x1 PEK2 #0060 ++ SWP2 DUP2 .mix-view/x1 LDZ2 #0060 ++ SWP2
.Audio0/volume [ DUPr STHr #10 * + ] DEI #0f AND ;draw-knob JSR2 .Audio0/volume [ DUPr STHr #10 * + ] DEI #0f AND ;draw-knob JSR2
POP2 POP2
POPr POPr
@ -397,8 +397,8 @@ RTN
DUPr STHr DUPr STHr
DUP #04 / SWP #04 MOD TOS PAD-WIDTH ** ( center ) .pad-view/x1 PEK2 ++ DUP #04 / SWP #04 MOD TOS PAD-WIDTH ** ( center ) .pad-view/x1 LDZ2 ++
ROT TOS PAD-HEIGHT ** ( center ) .pad-view/y1 PEK2 ++ ROT TOS PAD-HEIGHT ** ( center ) .pad-view/y1 LDZ2 ++
( draw outline ) ( draw outline )
OVR2 OVR2 OVR2 OVR2
@ -435,28 +435,28 @@ RTN
@draw-octave ( -- ) @draw-octave ( -- )
.oct-view/x1 PEK2 .oct-view/y1 PEK2 .oct-view/x1 LDZ2 .oct-view/y1 LDZ2
OVR2 OVR2 ;keys-left-icns #21 .piano/last PEK #00 = + ;draw-key JSR2 OVR2 OVR2 ;keys-left-icns #21 .piano/last LDZ #00 = + ;draw-key JSR2
OVR2 #0008 ++ OVR2 ;keys-middle-icns #21 .piano/last PEK #01 = + ;draw-key JSR2 OVR2 #0008 ++ OVR2 ;keys-middle-icns #21 .piano/last LDZ #01 = + ;draw-key JSR2
OVR2 #0010 ++ OVR2 ;keys-right-icns #21 .piano/last PEK #02 = + ;draw-key JSR2 OVR2 #0010 ++ OVR2 ;keys-right-icns #21 .piano/last LDZ #02 = + ;draw-key JSR2
OVR2 #0018 ++ OVR2 ;keys-left-icns #21 .piano/last PEK #03 = + ;draw-key JSR2 OVR2 #0018 ++ OVR2 ;keys-left-icns #21 .piano/last LDZ #03 = + ;draw-key JSR2
OVR2 #0020 ++ OVR2 ;keys-middle-icns #21 .piano/last PEK #04 = + ;draw-key JSR2 OVR2 #0020 ++ OVR2 ;keys-middle-icns #21 .piano/last LDZ #04 = + ;draw-key JSR2
OVR2 #0028 ++ OVR2 ;keys-middle-icns #21 .piano/last PEK #05 = + ;draw-key JSR2 OVR2 #0028 ++ OVR2 ;keys-middle-icns #21 .piano/last LDZ #05 = + ;draw-key JSR2
SWP2 #0030 ++ SWP2 ;keys-right-icns #21 .piano/last PEK #06 = + ;draw-key JSR2 SWP2 #0030 ++ SWP2 ;keys-right-icns #21 .piano/last LDZ #06 = + ;draw-key JSR2
.oct-view/x1 PEK2 #0040 ++ .Screen/x DEO2 .oct-view/x1 LDZ2 #0040 ++ .Screen/x DEO2
;arrow-icns .Screen/addr DEO2 ;arrow-icns .Screen/addr DEO2
.oct-view/y1 PEK2 .Screen/y DEO2 .oct-view/y1 LDZ2 .Screen/y DEO2
#21 .Screen/color DEO #21 .Screen/color DEO
;arrow-icns #0008 ++ .Screen/addr DEO2 ;arrow-icns #0008 ++ .Screen/addr DEO2
.oct-view/y1 PEK2 #0010 ++ .Screen/y DEO2 .oct-view/y1 LDZ2 #0010 ++ .Screen/y DEO2
#21 .Screen/color DEO #21 .Screen/color DEO
;font-hex .piano/octave PEK #03 + #00 SWP #0008 ** ++ .Screen/addr DEO2 ;font-hex .piano/octave LDZ #03 + #00 SWP #0008 ** ++ .Screen/addr DEO2
.oct-view/y1 PEK2 #0008 ++ .Screen/y DEO2 .oct-view/y1 LDZ2 #0008 ++ .Screen/y DEO2
#23 .Screen/color DEO #23 .Screen/color DEO
RTN RTN
@ -504,15 +504,15 @@ RTN
( clear last cursor ) ( clear last cursor )
;cursor-icn .Screen/addr DEO2 ;cursor-icn .Screen/addr DEO2
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x POK2 .Mouse/x DEI2 .pointer/x STZ2
.Mouse/y DEI2 .pointer/y POK2 .Mouse/y DEI2 .pointer/y STZ2
( draw new cursor ) ( draw new cursor )
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
( colorize on state ) ( colorize on state )
#33 [ .Mouse/state DEI #00 ! ] - .Screen/color DEO #33 [ .Mouse/state DEI #00 ! ] - .Screen/color DEO
@ -564,20 +564,20 @@ RTN
@line-rect ( x1* y1* x2* y2* color -- ) @line-rect ( x1* y1* x2* y2* color -- )
( load ) .color POK DUP2 STH2 .rect/y2 POK2 .rect/x2 POK2 DUP2 STH2 .rect/y1 POK2 .rect/x1 POK2 ( load ) .color STZ DUP2 STH2 .rect/y2 STZ2 .rect/x2 STZ2 DUP2 STH2 .rect/y1 STZ2 .rect/x1 STZ2
STH2r #0001 ++ STH2r STH2r #0001 ++ STH2r
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK DUP .Screen/color DEO ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .Screen/color DEO ( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/color DEO
( incr ) SWP2 #0001 ++ SWP2 ( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 LTS2 ,&ver JCN OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2 POP2 POP2
.rect/x1 PEK2 #0001 ++ .rect/x2 PEK2 #0001 -- .rect/x1 LDZ2 #0001 ++ .rect/x2 LDZ2 #0001 --
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK DUP .Screen/color DEO ( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .Screen/color DEO ( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/color DEO
( incr ) SWP2 #0001 ++ SWP2 ( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 #0001 ++ LTS2 ,&hor JCN OVR2 OVR2 #0001 ++ LTS2 ,&hor JCN
POP2 POP2 POP2 POP2
@ -601,14 +601,14 @@ RTN
@fill-rect ( x1* y1* x2* y2* color -- ) @fill-rect ( x1* y1* x2* y2* color -- )
.color POK .color STZ
( x1 x2 y1 y2 ) ROT2 SWP2 ( x1 x2 y1 y2 ) ROT2 SWP2
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
STH2 STH2 OVR2 OVR2 STH2 STH2 OVR2 OVR2
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
( incr ) SWP2 #0001 ++ SWP2 ( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 LTS2 ,&hor JCN OVR2 OVR2 LTS2 ,&hor JCN
POP2 POP2 STH2r STH2r POP2 POP2 STH2r STH2r

View File

@ -55,20 +55,20 @@
#07 #05 ;set-cell JSR2 #07 #05 ;set-cell JSR2
#06 #05 ;set-cell JSR2 #06 #05 ;set-cell JSR2
.Screen/width DEI2 #0002 // WIDTH TOS -- .anchor/x POK2 .Screen/width DEI2 #0002 // WIDTH TOS -- .anchor/x STZ2
.Screen/height DEI2 #0002 // HEIGHT TOS -- .anchor/y POK2 .Screen/height DEI2 #0002 // HEIGHT TOS -- .anchor/y STZ2
#01 .world/paused POK #01 .world/paused STZ
BRK BRK
@on-frame ( -> ) @on-frame ( -> )
.Mouse/state DEI #00 = #01 JCN [ BRK ] .Mouse/state DEI #00 = #01 JCN [ BRK ]
.world/paused PEK #00 ! #01 JCN [ BRK ] .world/paused LDZ #00 ! #01 JCN [ BRK ]
( incr frame ) .world/frame PEK INCR [ DUP ] .world/frame POK ( incr frame ) .world/frame LDZ INCR [ DUP ] .world/frame STZ
( reset count ) #0000 .world/count POK2 ( reset count ) #0000 .world/count STZ2
#10 MOD #00 ! #01 JCN [ BRK ] #10 MOD #00 ! #01 JCN [ BRK ]
@ -94,9 +94,9 @@ BRK
;draw-grid JSR2 ;draw-grid JSR2
( draw cell count ) ( draw cell count )
.anchor/x PEK2 .Screen/x DEO2 .anchor/x LDZ2 .Screen/x DEO2
.anchor/y PEK2 HEIGHT #02 * TOS ++ .Screen/y DEO2 .anchor/y LDZ2 HEIGHT #02 * TOS ++ .Screen/y DEO2
.world/count PEK2 #22 ;draw-short JSR2 .world/count LDZ2 #22 ;draw-short JSR2
BRK BRK
@ -104,29 +104,29 @@ BRK
( clear last cursor ) ( clear last cursor )
;cursor .Screen/addr DEO2 ;cursor .Screen/addr DEO2
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x POK2 .Mouse/x DEI2 .pointer/x STZ2
.Mouse/y DEI2 .pointer/y POK2 .Mouse/y DEI2 .pointer/y STZ2
( draw new cursor ) ( draw new cursor )
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
( colorize on state ) ( colorize on state )
#32 [ .Mouse/state DEI #00 ! ] + .Screen/color DEO #32 [ .Mouse/state DEI #00 ! ] + .Screen/color DEO
.Mouse/state DEI #00 ! #01 JCN [ BRK ] .Mouse/state DEI #00 ! #01 JCN [ BRK ]
.Mouse/x DEI2 DUP2 .anchor/x PEK2 >> ROT ROT .anchor/x PEK2 WIDTH #02 * TOS ++ #0001 ++ << #0101 == .Mouse/x DEI2 DUP2 .anchor/x LDZ2 >> ROT ROT .anchor/x LDZ2 WIDTH #02 * TOS ++ #0001 ++ << #0101 ==
.Mouse/y DEI2 DUP2 .anchor/y PEK2 >> ROT ROT .anchor/y PEK2 HEIGHT #02 * TOS ++ << #0101 == .Mouse/y DEI2 DUP2 .anchor/y LDZ2 >> ROT ROT .anchor/y LDZ2 HEIGHT #02 * TOS ++ << #0101 ==
#0101 == #01 JCN [ BRK ] #0101 == #01 JCN [ BRK ]
.Mouse/x DEI2 .anchor/x PEK2 SUB2 #02 / TOB .Mouse/x DEI2 .anchor/x LDZ2 SUB2 #02 / TOB
.Mouse/y DEI2 .anchor/y PEK2 SUB2 #02 / TOB .Mouse/y DEI2 .anchor/y LDZ2 SUB2 #02 / TOB
;set-cell JSR2 ;set-cell JSR2
;draw-grid JSR2 ;draw-grid JSR2
@ -138,7 +138,7 @@ BRK
.Controller/key DEI #00 ! #01 JCN [ BRK ] .Controller/key DEI #00 ! #01 JCN [ BRK ]
.Controller/key DEI #20 ! ,&no-toggle JCN .Controller/key DEI #20 ! ,&no-toggle JCN
.world/paused PEK #01 ! .world/paused POK .world/paused LDZ #01 ! .world/paused STZ
&no-toggle &no-toggle
BRK BRK
@ -147,11 +147,11 @@ BRK
#00 HEIGHT #00 HEIGHT
&ver &ver
OVR TOS #0002 ** .anchor/y PEK2 ++ .Screen/y DEO2 OVR TOS #0002 ** .anchor/y LDZ2 ++ .Screen/y DEO2
OVR STH OVR STH
#00 WIDTH #00 WIDTH
&hor &hor
OVR TOS #0002 ** .anchor/x PEK2 ++ .Screen/x DEO2 OVR TOS #0002 ** .anchor/x LDZ2 ++ .Screen/x DEO2
OVR DUPr STHr ,get-cell JSR INCR .Screen/color DEO OVR DUPr STHr ,get-cell JSR INCR .Screen/color DEO
SWP INCR SWP SWP INCR SWP
DUP2 ! ,&hor JCN DUP2 ! ,&hor JCN
@ -242,7 +242,7 @@ RTN
HEIGHT MOD SWP WIDTH MOD SWP HEIGHT MOD SWP WIDTH MOD SWP
WIDTH #08 / TOS ROT TOS ** ROT #08 / TOS ++ [ BANK2 ++ ] WIDTH #08 / TOS ROT TOS ** ROT #08 / TOS ++ [ BANK2 ++ ]
( incr count ) ( incr count )
.world/count PEK2 #0001 ADD2 .world/count POK2 .world/count LDZ2 #0001 ADD2 .world/count STZ2
( save in buffer ) ( save in buffer )
STH2 STH2
DUP2 POP #08 MOD #01 SWP SFL DUP2 POP #08 MOD #01 SWP SFL

View File

@ -5,7 +5,7 @@
%8* { #0008 MUL2 } %8/ { #0008 DIV2 } %8* { #0008 MUL2 } %8/ { #0008 DIV2 }
%++ { #0001 ADD2 } %++ { #0001 ADD2 }
%MOD { DUP2 DIV MUL SUB } %MOD { DUP2 DIV MUL SUB }
%TRACK { ;track/ch1 #00 .track/active PEK #0020 MUL2 ADD2 } %TRACK { ;track/ch1 #00 .track/active LDZ #0020 MUL2 ADD2 }
( variables ) ( variables )
@ -43,16 +43,16 @@
( vectors ) ;on-mouse .Mouse/vector DEO2 ( vectors ) ;on-mouse .Mouse/vector DEO2
( vectors ) ;on-button .Controller/vector DEO2 ( vectors ) ;on-button .Controller/vector DEO2
.Screen/width DEI2 #0002 DIV2 DUP2 #0080 SUB2 .trkframe/x1 POK2 .Screen/width DEI2 #0002 DIV2 DUP2 #0080 SUB2 .trkframe/x1 STZ2
#0080 ADD2 .trkframe/x2 POK2 #0080 ADD2 .trkframe/x2 STZ2
.Screen/height DEI2 #0002 DIV2 DUP2 #0038 SUB2 #0010 SUB2 .trkframe/y1 POK2 .Screen/height DEI2 #0002 DIV2 DUP2 #0038 SUB2 #0010 SUB2 .trkframe/y1 STZ2
#0038 ADD2 #0010 SUB2 .trkframe/y2 POK2 #0038 ADD2 #0010 SUB2 .trkframe/y2 STZ2
.trkframe/x1 PEK2 .chnframe/x1 POK2 .trkframe/y2 PEK2 .chnframe/y1 POK2 .trkframe/x1 LDZ2 .chnframe/x1 STZ2 .trkframe/y2 LDZ2 .chnframe/y1 STZ2
.chnframe/x1 PEK2 #0030 ADD2 .chnframe/x2 POK2 .chnframe/y1 PEK2 #0030 ADD2 .chnframe/y2 POK2 .chnframe/x1 LDZ2 #0030 ADD2 .chnframe/x2 STZ2 .chnframe/y1 LDZ2 #0030 ADD2 .chnframe/y2 STZ2
.chnframe/x2 PEK2 .ctlframe/x1 POK2 .chnframe/y1 PEK2 .ctlframe/y1 POK2 .chnframe/x2 LDZ2 .ctlframe/x1 STZ2 .chnframe/y1 LDZ2 .ctlframe/y1 STZ2
.trkframe/x2 PEK2 .ctlframe/x2 POK2 .chnframe/y2 PEK2 .ctlframe/y2 POK2 .trkframe/x2 LDZ2 .ctlframe/x2 STZ2 .chnframe/y2 LDZ2 .ctlframe/y2 STZ2
( default settings ) ( default settings )
#048c .Audio0/adsr DEO2 #88 .Audio0/volume DEO #048c .Audio0/adsr DEO2 #88 .Audio0/volume DEO
@ -79,7 +79,7 @@ BRK
;move-head JSR2 ;move-head JSR2
;draw-vu JSR2 ;draw-vu JSR2
.head/pos PEK #08 MOD #00 NEQ ,&skip JCN .head/pos LDZ #08 MOD #00 NEQ ,&skip JCN
;bang JSR2 ;bang JSR2
&skip &skip
@ -88,14 +88,14 @@ BRK
@on-mouse ( -> ) @on-mouse ( -> )
.Mouse/state DEI #00 EQU ;&click-end JCN2 .Mouse/state DEI #00 EQU ;&click-end JCN2
.Mouse/x DEI2 .trkframe/x1 PEK2 GTH2 .Mouse/x DEI2 .trkframe/x2 PEK2 LTH2 #0101 EQU2 .Mouse/x DEI2 .trkframe/x1 LDZ2 GTH2 .Mouse/x DEI2 .trkframe/x2 LDZ2 LTH2 #0101 EQU2
.Mouse/y DEI2 .trkframe/y1 PEK2 GTH2 .Mouse/y DEI2 .trkframe/y2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 .trkframe/y1 LDZ2 GTH2 .Mouse/y DEI2 .trkframe/y2 LDZ2 LTH2 #0101 EQU2
#0101 EQU2 ;touch-trk JCN2 #0101 EQU2 ;touch-trk JCN2
.Mouse/x DEI2 .chnframe/x1 PEK2 GTH2 .Mouse/x DEI2 .chnframe/x2 PEK2 LTH2 #0101 EQU2 .Mouse/x DEI2 .chnframe/x1 LDZ2 GTH2 .Mouse/x DEI2 .chnframe/x2 LDZ2 LTH2 #0101 EQU2
.Mouse/y DEI2 .chnframe/y1 PEK2 8+ GTH2 .Mouse/y DEI2 .chnframe/y2 PEK2 8- LTH2 #0101 EQU2 .Mouse/y DEI2 .chnframe/y1 LDZ2 8+ GTH2 .Mouse/y DEI2 .chnframe/y2 LDZ2 8- LTH2 #0101 EQU2
#0101 EQU2 ;touch-chn JCN2 #0101 EQU2 ;touch-chn JCN2
.Mouse/x DEI2 .ctlframe/x1 PEK2 GTH2 .Mouse/x DEI2 .ctlframe/x2 PEK2 LTH2 #0101 EQU2 .Mouse/x DEI2 .ctlframe/x1 LDZ2 GTH2 .Mouse/x DEI2 .ctlframe/x2 LDZ2 LTH2 #0101 EQU2
.Mouse/y DEI2 .ctlframe/y1 PEK2 8+ GTH2 .Mouse/y DEI2 .ctlframe/y2 PEK2 8- LTH2 #0101 EQU2 .Mouse/y DEI2 .ctlframe/y1 LDZ2 8+ GTH2 .Mouse/y DEI2 .ctlframe/y2 LDZ2 8- LTH2 #0101 EQU2
#0101 EQU2 ;touch-ctl JCN2 #0101 EQU2 ;touch-ctl JCN2
&click-end &click-end
@ -136,10 +136,10 @@ RTN
;clear-notes JSR2 ;clear-notes JSR2
( get note ) ( get note )
#0e .Mouse/y DEI2 .trkframe/y1 PEK2 SUB2 SWP POP #08 DIV SUB #0e .Mouse/y DEI2 .trkframe/y1 LDZ2 SUB2 SWP POP #08 DIV SUB
.Mouse/state DEI #10 NEQ ,&no-erase JCN POP #00 &no-erase .Mouse/state DEI #10 NEQ ,&no-erase JCN POP #00 &no-erase
( edit note ) ( edit note )
TRACK #00 .Mouse/x DEI2 .trkframe/x1 PEK2 SUB2 SWP POP #08 DIV ADD2 STA TRACK #00 .Mouse/x DEI2 .trkframe/x1 LDZ2 SUB2 SWP POP #08 DIV ADD2 STA
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-notes JSR2 ;draw-notes JSR2
@ -148,7 +148,7 @@ BRK
@touch-chn ( -- ) @touch-chn ( -- )
;clear-notes JSR2 ;clear-notes JSR2
( save ) .Mouse/y DEI2 .chnframe/y1 PEK2 SUB2 SWP POP #08 DIV #01 SUB .track/active POK ( save ) .Mouse/y DEI2 .chnframe/y1 LDZ2 SUB2 SWP POP #08 DIV #01 SUB .track/active STZ
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-channels JSR2 ;draw-channels JSR2
;draw-notes JSR2 ;draw-notes JSR2
@ -158,31 +158,31 @@ BRK
@touch-ctl ( -- ) @touch-ctl ( -- )
.Mouse/x DEI2 .ctlframe/x1 PEK2 SUB2 8- 8/ SWP POP #02 DIV .Mouse/x DEI2 .ctlframe/x1 LDZ2 SUB2 8- 8/ SWP POP #02 DIV
DUP #00 NEQ ,&no-a JCN DUP #00 NEQ ,&no-a JCN
.Audio0/adsr .track/active PEK #10 MUL ADD DEI .Audio0/adsr .track/active LDZ #10 MUL ADD DEI
#10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD #10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD
.Audio0/adsr .track/active PEK #10 MUL ADD DEO &no-a .Audio0/adsr .track/active LDZ #10 MUL ADD DEO &no-a
DUP #01 NEQ ,&no-d JCN DUP #01 NEQ ,&no-d JCN
.Audio0/adsr .track/active PEK #10 MUL ADD DEI .Audio0/adsr .track/active LDZ #10 MUL ADD DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD
.Audio0/adsr .track/active PEK #10 MUL ADD DEO &no-d .Audio0/adsr .track/active LDZ #10 MUL ADD DEO &no-d
DUP #02 NEQ ,&no-s JCN DUP #02 NEQ ,&no-s JCN
.Audio0/adsr .track/active PEK #10 MUL ADD #01 ADD DEI .Audio0/adsr .track/active LDZ #10 MUL ADD #01 ADD DEI
#10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD #10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD
.Audio0/adsr .track/active PEK #10 MUL ADD #01 ADD DEO &no-s .Audio0/adsr .track/active LDZ #10 MUL ADD #01 ADD DEO &no-s
DUP #03 NEQ ,&no-r JCN DUP #03 NEQ ,&no-r JCN
.Audio0/adsr .track/active PEK #10 MUL ADD #01 ADD DEI .Audio0/adsr .track/active LDZ #10 MUL ADD #01 ADD DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD
.Audio0/adsr .track/active PEK #10 MUL ADD #01 ADD DEO &no-r .Audio0/adsr .track/active LDZ #10 MUL ADD #01 ADD DEO &no-r
DUP #05 NEQ ,&no-left JCN DUP #05 NEQ ,&no-left JCN
.Audio0/volume .track/active PEK #10 MUL ADD DEI .Audio0/volume .track/active LDZ #10 MUL ADD DEI
#10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD #10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD
.Audio0/volume .track/active PEK #10 MUL ADD DEO &no-left .Audio0/volume .track/active LDZ #10 MUL ADD DEO &no-left
DUP #06 NEQ ,&no-right JCN DUP #06 NEQ ,&no-right JCN
.Audio0/volume .track/active PEK #10 MUL ADD DEI .Audio0/volume .track/active LDZ #10 MUL ADD DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD
.Audio0/volume .track/active PEK #10 MUL ADD DEO &no-right .Audio0/volume .track/active LDZ #10 MUL ADD DEO &no-right
POP POP
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-controls JSR2 ;draw-controls JSR2
@ -191,28 +191,28 @@ BRK
@bang ( -- ) @bang ( -- )
;track/ch1 #00 .head/pos PEK #08 DIV ADD2 LDA ;track/ch1 #00 .head/pos LDZ #08 DIV ADD2 LDA
#01 SUB #01 SUB
DUP #ff NEQ ,&skip1 JCN DUP #ff NEQ ,&skip1 JCN
POP ,&listen2 JMP POP ,&listen2 JMP
&skip1 &skip1
#00 SWP ;notes ADD2 LDA .Audio0/pitch DEO #00 SWP ;notes ADD2 LDA .Audio0/pitch DEO
&listen2 &listen2
;track/ch2 #00 .head/pos PEK #08 DIV ADD2 LDA ;track/ch2 #00 .head/pos LDZ #08 DIV ADD2 LDA
#01 SUB #01 SUB
DUP #ff NEQ ,&skip2 JCN DUP #ff NEQ ,&skip2 JCN
POP ,&listen3 JMP POP ,&listen3 JMP
&skip2 &skip2
#00 SWP ;notes ADD2 LDA .Audio1/pitch DEO #00 SWP ;notes ADD2 LDA .Audio1/pitch DEO
&listen3 &listen3
;track/ch3 #00 .head/pos PEK #08 DIV ADD2 LDA ;track/ch3 #00 .head/pos LDZ #08 DIV ADD2 LDA
#01 SUB #01 SUB
DUP #ff NEQ ,&skip3 JCN DUP #ff NEQ ,&skip3 JCN
POP ,&listen4 JMP POP ,&listen4 JMP
&skip3 &skip3
#00 SWP ;notes ADD2 LDA .Audio2/pitch DEO #00 SWP ;notes ADD2 LDA .Audio2/pitch DEO
&listen4 &listen4
;track/ch4 #00 .head/pos PEK #08 DIV ADD2 LDA ;track/ch4 #00 .head/pos LDZ #08 DIV ADD2 LDA
#01 SUB #01 SUB
DUP #ff NEQ ,&skip4 JCN DUP #ff NEQ ,&skip4 JCN
POP ,&end JMP POP ,&end JMP
@ -225,14 +225,14 @@ RTN
@move-head ( -- ) @move-head ( -- )
( clear ) ( clear )
.trkframe/y1 PEK2 8- .Screen/y DEO2 .trkframe/y1 LDZ2 8- .Screen/y DEO2
.trkframe/x1 PEK2 #00 .head/pos PEK ADD2 .Screen/x DEO2 .trkframe/x1 LDZ2 #00 .head/pos LDZ ADD2 .Screen/x DEO2
;head_icn .Screen/addr DEO2 ;head_icn .Screen/addr DEO2
#20 .Screen/color DEO #20 .Screen/color DEO
( incr ) .head/pos PEK #01 ADD .head/pos POK ( incr ) .head/pos LDZ #01 ADD .head/pos STZ
.trkframe/x1 PEK2 #00 .head/pos PEK ADD2 .Screen/x DEO2 .trkframe/x1 LDZ2 #00 .head/pos LDZ ADD2 .Screen/x DEO2
;head_icn .Screen/addr DEO2 ;head_icn .Screen/addr DEO2
#21 ( if note ) TRACK #00 .head/pos PEK #08 DIV ADD2 LDA #00 NEQ ADD .Screen/color DEO #21 ( if note ) TRACK #00 .head/pos LDZ #08 DIV ADD2 LDA #00 NEQ ADD .Screen/color DEO
RTN RTN
@ -241,8 +241,8 @@ RTN
#00 #20 #00 #20
&loop &loop
( load ) OVR #00 SWP TRACK ADD2 LDA ( load ) OVR #00 SWP TRACK ADD2 LDA
DUP STH #00 SWP #0e SWP SUB 8* .trkframe/y1 PEK2 ADD2 .Screen/y DEO2 DUP STH #00 SWP #0e SWP SUB 8* .trkframe/y1 LDZ2 ADD2 .Screen/y DEO2
OVR #00 SWP 8* .trkframe/x1 PEK2 ADD2 .Screen/x DEO2 OVR #00 SWP 8* .trkframe/x1 LDZ2 ADD2 .Screen/x DEO2
STHr #00 EQU ,&skip JCN STHr #00 EQU ,&skip JCN
#20 .Screen/color DEO #20 .Screen/color DEO
&skip &skip
@ -257,8 +257,8 @@ RTN
#00 #20 #00 #20
&notes-loop &notes-loop
( load ) OVR #00 SWP TRACK ADD2 LDA ( load ) OVR #00 SWP TRACK ADD2 LDA
DUP STH #00 SWP #0e SWP SUB 8* .trkframe/y1 PEK2 ADD2 .Screen/y DEO2 DUP STH #00 SWP #0e SWP SUB 8* .trkframe/y1 LDZ2 ADD2 .Screen/y DEO2
OVR #00 SWP 8* .trkframe/x1 PEK2 ADD2 .Screen/x DEO2 OVR #00 SWP 8* .trkframe/x1 LDZ2 ADD2 .Screen/x DEO2
;note_icn .Screen/addr DEO2 ;note_icn .Screen/addr DEO2
STHr #00 EQU ,&skip JCN STHr #00 EQU ,&skip JCN
#25 .Screen/color DEO #25 .Screen/color DEO
@ -272,27 +272,27 @@ RTN
@draw-bars ( -- ) @draw-bars ( -- )
.trkframe/x1 PEK2 .trkframe/y1 PEK2 .trkframe/x2 PEK2 .trkframe/y2 PEK2 #01 ;line-rect JSR2 .trkframe/x1 LDZ2 .trkframe/y1 LDZ2 .trkframe/x2 LDZ2 .trkframe/y2 LDZ2 #01 ;line-rect JSR2
( grid ) ( grid )
.trkframe/y1 PEK2 #0010 SUB2 .Screen/y DEO2 .trkframe/y1 LDZ2 #0010 SUB2 .Screen/y DEO2
;font_hex .Screen/addr DEO2 ;font_hex .Screen/addr DEO2
#0000 #0100 #0000 #0100
&loop &loop
OVR2 SWP POP #02 DIV #0f AND #00 NEQ ,&skip JCN OVR2 SWP POP #02 DIV #0f AND #00 NEQ ,&skip JCN
OVR2 .trkframe/x1 PEK2 ADD2 .Screen/x DEO2 OVR2 .trkframe/x1 LDZ2 ADD2 .Screen/x DEO2
.trkframe/y1 PEK2 #0010 SUB2 .Screen/y DEO2 .trkframe/y1 LDZ2 #0010 SUB2 .Screen/y DEO2
#22 .Screen/color DEO #22 .Screen/color DEO
.Screen/addr DEI2 8+ .Screen/addr DEO2 .Screen/addr DEI2 8+ .Screen/addr DEO2
OVR2 .trkframe/x1 PEK2 ADD2 .trkframe/y1 PEK2 ++ .trkframe/y2 PEK2 #01 ;line-vertical-dotted JSR2 OVR2 .trkframe/x1 LDZ2 ADD2 .trkframe/y1 LDZ2 ++ .trkframe/y2 LDZ2 #01 ;line-vertical-dotted JSR2
&skip &skip
OVR2 .trkframe/x1 PEK2 ADD2 .trkframe/y1 PEK2 .trkframe/y2 PEK2 #01 ;line-vertical-dotted JSR2 OVR2 .trkframe/x1 LDZ2 ADD2 .trkframe/y1 LDZ2 .trkframe/y2 LDZ2 #01 ;line-vertical-dotted JSR2
SWP2 8+ SWP2 SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&loop JCN OVR2 OVR2 LTH2 ,&loop JCN
POP2 POP2
POP2 POP2
.trkframe/x1 PEK2 .trkframe/x2 PEK2 .trkframe/y1 PEK2 8- #0040 ADD2 #01 ;line-horizontal-dotted JSR2 .trkframe/x1 LDZ2 .trkframe/x2 LDZ2 .trkframe/y1 LDZ2 8- #0040 ADD2 #01 ;line-horizontal-dotted JSR2
RTN RTN
@ -319,20 +319,20 @@ RTN
@draw-octaves ( -- ) @draw-octaves ( -- )
.trkframe/x1 PEK2 #0018 SUB2 DUP2 .trkframe/y1 PEK2 ;draw-octave JSR2 .trkframe/x1 LDZ2 #0018 SUB2 DUP2 .trkframe/y1 LDZ2 ;draw-octave JSR2
.trkframe/y1 PEK2 #0038 ADD2 ;draw-octave JSR2 .trkframe/y1 LDZ2 #0038 ADD2 ;draw-octave JSR2
.trkframe/x1 PEK2 #0028 SUB2 .Screen/x DEO2 .trkframe/x1 LDZ2 #0028 SUB2 .Screen/x DEO2
.trkframe/y1 PEK2 #0030 ADD2 .Screen/y DEO2 .trkframe/y1 LDZ2 #0030 ADD2 .Screen/y DEO2
;font_hex #0020 ADD2 .Screen/addr DEO2 ;font_hex #0020 ADD2 .Screen/addr DEO2
#23 .Screen/color DEO #23 .Screen/color DEO
.trkframe/x1 PEK2 #0030 SUB2 .Screen/x DEO2 .trkframe/x1 LDZ2 #0030 SUB2 .Screen/x DEO2
;font_hex #0060 ADD2 .Screen/addr DEO2 ;font_hex #0060 ADD2 .Screen/addr DEO2
#23 .Screen/color DEO #23 .Screen/color DEO
.trkframe/x1 PEK2 #0028 SUB2 .Screen/x DEO2 .trkframe/x1 LDZ2 #0028 SUB2 .Screen/x DEO2
.trkframe/y1 PEK2 #0068 ADD2 .Screen/y DEO2 .trkframe/y1 LDZ2 #0068 ADD2 .Screen/y DEO2
;font_hex #0018 ADD2 .Screen/addr DEO2 ;font_hex #0018 ADD2 .Screen/addr DEO2
#23 .Screen/color DEO #23 .Screen/color DEO
.trkframe/x1 PEK2 #0030 SUB2 .Screen/x DEO2 .trkframe/x1 LDZ2 #0030 SUB2 .Screen/x DEO2
;font_hex #0060 ADD2 .Screen/addr DEO2 ;font_hex #0060 ADD2 .Screen/addr DEO2
#23 .Screen/color DEO #23 .Screen/color DEO
@ -346,74 +346,74 @@ RTN
RTN RTN
@draw-knob ( x* y* value -- ) @draw-knob ( x* y* value -- )
.track/active PEK #03 EQU ;&blank JCN2 .track/active LDZ #03 EQU ;&blank JCN2
&force &force
( load ) .knob/value POK .knob/y POK2 .knob/x POK2 ( load ) .knob/value STZ .knob/y STZ2 .knob/x STZ2
.knob/x PEK2 .Screen/x DEO2 .knob/x LDZ2 .Screen/x DEO2
.knob/y PEK2 .Screen/y DEO2 ;knob_icns .Screen/addr DEO2 #21 .Screen/color DEO .knob/y LDZ2 .Screen/y DEO2 ;knob_icns .Screen/addr DEO2 #21 .Screen/color DEO
.knob/x PEK2 8+ .Screen/x DEO2 ;knob_icns 8+ .Screen/addr DEO2 #21 .Screen/color DEO .knob/x LDZ2 8+ .Screen/x DEO2 ;knob_icns 8+ .Screen/addr DEO2 #21 .Screen/color DEO
.knob/y PEK2 8+ .Screen/y DEO2 ;knob_icns #0018 ADD2 .Screen/addr DEO2 #21 .Screen/color DEO .knob/y LDZ2 8+ .Screen/y DEO2 ;knob_icns #0018 ADD2 .Screen/addr DEO2 #21 .Screen/color DEO
.knob/x PEK2 .Screen/x DEO2 ;knob_icns #0010 ADD2 .Screen/addr DEO2 #21 .Screen/color DEO .knob/x LDZ2 .Screen/x DEO2 ;knob_icns #0010 ADD2 .Screen/addr DEO2 #21 .Screen/color DEO
.knob/x PEK2 #00 #00 .knob/value PEK ;knob_offsetx ADD2 LDA ADD2 .Screen/x DEO2 .knob/x LDZ2 #00 #00 .knob/value LDZ ;knob_offsetx ADD2 LDA ADD2 .Screen/x DEO2
.knob/y PEK2 #00 #00 .knob/value PEK ;knob_offsety ADD2 LDA ADD2 .Screen/y DEO2 .knob/y LDZ2 #00 #00 .knob/value LDZ ;knob_offsety ADD2 LDA ADD2 .Screen/y DEO2
;knob_icns #0020 ADD2 .Screen/addr DEO2 ;knob_icns #0020 ADD2 .Screen/addr DEO2
#25 .Screen/color DEO #25 .Screen/color DEO
.knob/x PEK2 #0004 ADD2 .Screen/x DEO2 .knob/x LDZ2 #0004 ADD2 .Screen/x DEO2
.knob/y PEK2 #0010 ADD2 .Screen/y DEO2 .knob/y LDZ2 #0010 ADD2 .Screen/y DEO2
;font_hex #00 .knob/value PEK #08 MUL ADD2 .Screen/addr DEO2 ;font_hex #00 .knob/value LDZ #08 MUL ADD2 .Screen/addr DEO2
#21 .Screen/color DEO #21 .Screen/color DEO
RTN RTN
&blank &blank
( load ) .knob/value POK .knob/y POK2 .knob/x POK2 ( load ) .knob/value STZ .knob/y STZ2 .knob/x STZ2
.knob/x PEK2 .Screen/x DEO2 .knob/x LDZ2 .Screen/x DEO2
.knob/y PEK2 .Screen/y DEO2 #20 .Screen/color DEO .knob/y LDZ2 .Screen/y DEO2 #20 .Screen/color DEO
.knob/x PEK2 8+ .Screen/x DEO2 #20 .Screen/color DEO .knob/x LDZ2 8+ .Screen/x DEO2 #20 .Screen/color DEO
.knob/y PEK2 8+ .Screen/y DEO2 #20 .Screen/color DEO .knob/y LDZ2 8+ .Screen/y DEO2 #20 .Screen/color DEO
.knob/x PEK2 .Screen/x DEO2 #20 .Screen/color DEO .knob/x LDZ2 .Screen/x DEO2 #20 .Screen/color DEO
.knob/x PEK2 #0004 ADD2 .Screen/x DEO2 .knob/x LDZ2 #0004 ADD2 .Screen/x DEO2
.knob/y PEK2 #0010 ADD2 .Screen/y DEO2 .knob/y LDZ2 #0010 ADD2 .Screen/y DEO2
#20 .Screen/color DEO #20 .Screen/color DEO
RTN RTN
@draw-controls ( -- ) @draw-controls ( -- )
.ctlframe/x1 PEK2 .ctlframe/y1 PEK2 .ctlframe/x2 PEK2 .ctlframe/y2 PEK2 #01 ;line-rect JSR2 .ctlframe/x1 LDZ2 .ctlframe/y1 LDZ2 .ctlframe/x2 LDZ2 .ctlframe/y2 LDZ2 #01 ;line-rect JSR2
( env ) ( env )
.ctlframe/x1 PEK2 8+ .ctlframe/y1 PEK2 8+ #22 ;env_txt ;draw-label JSR2 .ctlframe/x1 LDZ2 8+ .ctlframe/y1 LDZ2 8+ #22 ;env_txt ;draw-label JSR2
.ctlframe/x1 PEK2 8+ .ctlframe/y1 PEK2 #0010 ADD2 .ctlframe/x1 LDZ2 8+ .ctlframe/y1 LDZ2 #0010 ADD2
.Audio0/adsr .track/active PEK #10 MUL ADD DEI #04 SFT .Audio0/adsr .track/active LDZ #10 MUL ADD DEI #04 SFT
;draw-knob JSR2 ;draw-knob JSR2
.ctlframe/x1 PEK2 #0018 ADD2 .ctlframe/y1 PEK2 #0010 ADD2 .ctlframe/x1 LDZ2 #0018 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
.Audio0/adsr .track/active PEK #10 MUL ADD DEI #0f AND .Audio0/adsr .track/active LDZ #10 MUL ADD DEI #0f AND
;draw-knob JSR2 ;draw-knob JSR2
.ctlframe/x1 PEK2 #0028 ADD2 .ctlframe/y1 PEK2 #0010 ADD2 .ctlframe/x1 LDZ2 #0028 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
.Audio0/adsr .track/active PEK #10 MUL ADD #01 ADD DEI #04 SFT .Audio0/adsr .track/active LDZ #10 MUL ADD #01 ADD DEI #04 SFT
;draw-knob JSR2 ;draw-knob JSR2
.ctlframe/x1 PEK2 #0038 ADD2 .ctlframe/y1 PEK2 #0010 ADD2 .ctlframe/x1 LDZ2 #0038 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
.Audio0/adsr .track/active PEK #10 MUL ADD #01 ADD DEI #0f AND .Audio0/adsr .track/active LDZ #10 MUL ADD #01 ADD DEI #0f AND
;draw-knob JSR2 ;draw-knob JSR2
( vol ) ( vol )
.ctlframe/x1 PEK2 #0058 ADD2 .ctlframe/y1 PEK2 8+ #22 ;vol_txt ;draw-label JSR2 .ctlframe/x1 LDZ2 #0058 ADD2 .ctlframe/y1 LDZ2 8+ #22 ;vol_txt ;draw-label JSR2
.ctlframe/x1 PEK2 #0058 ADD2 .ctlframe/y1 PEK2 #0010 ADD2 .ctlframe/x1 LDZ2 #0058 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
.Audio0/volume .track/active PEK #10 MUL ADD DEI #04 SFT .Audio0/volume .track/active LDZ #10 MUL ADD DEI #04 SFT
;draw-knob/force JSR2 ;draw-knob/force JSR2
.ctlframe/x1 PEK2 #0068 ADD2 .ctlframe/y1 PEK2 #0010 ADD2 .ctlframe/x1 LDZ2 #0068 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
.Audio0/volume .track/active PEK #10 MUL ADD DEI #0f AND .Audio0/volume .track/active LDZ #10 MUL ADD DEI #0f AND
;draw-knob/force JSR2 ;draw-knob/force JSR2
RTN RTN
@draw-vu ( -- ) @draw-vu ( -- )
.ctlframe/x1 PEK2 #0088 ADD2 .ctlframe/y1 PEK2 #0010 ADD2 .ctlframe/x1 LDZ2 #0088 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
.Audio0/output .track/active PEK #10 MUL ADD DEI DUP STH #04 SFT .Audio0/output .track/active LDZ #10 MUL ADD DEI DUP STH #04 SFT
;draw-knob/force JSR2 ;draw-knob/force JSR2
.ctlframe/x1 PEK2 #0098 ADD2 .ctlframe/y1 PEK2 #0010 ADD2 .ctlframe/x1 LDZ2 #0098 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
STHr #0f AND STHr #0f AND
;draw-knob/force JSR2 ;draw-knob/force JSR2
@ -421,11 +421,11 @@ RTN
@draw-channels @draw-channels
.chnframe/x1 PEK2 .chnframe/y1 PEK2 .chnframe/x2 PEK2 .chnframe/y2 PEK2 #01 ;line-rect JSR2 .chnframe/x1 LDZ2 .chnframe/y1 LDZ2 .chnframe/x2 LDZ2 .chnframe/y2 LDZ2 #01 ;line-rect JSR2
.chnframe/x1 PEK2 8+ .chnframe/y1 PEK2 8+ #21 .track/active PEK #00 EQU #07 MUL ADD ;ch1_txt ;draw-label JSR2 .chnframe/x1 LDZ2 8+ .chnframe/y1 LDZ2 8+ #21 .track/active LDZ #00 EQU #07 MUL ADD ;ch1_txt ;draw-label JSR2
.chnframe/x1 PEK2 8+ .chnframe/y1 PEK2 #0010 ADD2 #21 .track/active PEK #01 EQU #07 MUL ADD ;ch2_txt ;draw-label JSR2 .chnframe/x1 LDZ2 8+ .chnframe/y1 LDZ2 #0010 ADD2 #21 .track/active LDZ #01 EQU #07 MUL ADD ;ch2_txt ;draw-label JSR2
.chnframe/x1 PEK2 8+ .chnframe/y1 PEK2 #0018 ADD2 #21 .track/active PEK #02 EQU #07 MUL ADD ;ch3_txt ;draw-label JSR2 .chnframe/x1 LDZ2 8+ .chnframe/y1 LDZ2 #0018 ADD2 #21 .track/active LDZ #02 EQU #07 MUL ADD ;ch3_txt ;draw-label JSR2
.chnframe/x1 PEK2 8+ .chnframe/y1 PEK2 #0020 ADD2 #21 .track/active PEK #03 EQU #07 MUL ADD ;ch4_txt ;draw-label JSR2 .chnframe/x1 LDZ2 8+ .chnframe/y1 LDZ2 #0020 ADD2 #21 .track/active LDZ #03 EQU #07 MUL ADD ;ch4_txt ;draw-label JSR2
RTN RTN
@ -433,15 +433,15 @@ RTN
( clear last cursor ) ( clear last cursor )
;clear_icn .Screen/addr DEO2 ;clear_icn .Screen/addr DEO2
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x POK2 .Mouse/y DEI2 .pointer/y POK2 .Mouse/x DEI2 .pointer/x STZ2 .Mouse/y DEI2 .pointer/y STZ2
( draw new cursor ) ( draw new cursor )
;cursor_icn .Screen/addr DEO2 ;cursor_icn .Screen/addr DEO2
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#32 .Mouse/state DEI #00 NEQ ADD .Screen/color DEO #32 .Mouse/state DEI #00 NEQ ADD .Screen/color DEO
RTN RTN
@ -450,10 +450,10 @@ RTN
@draw-label ( x y color addr -- ) @draw-label ( x y color addr -- )
( load ) .label/addr POK2 .label/color POK .Screen/y DEO2 .Screen/x DEO2 ( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2 .Screen/x DEO2
.label/addr PEK2 .label/addr LDZ2
&loop &loop
( draw ) DUP2 LDA #00 SWP 8* ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO ( draw ) DUP2 LDA #00 SWP 8* ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/color DEO
( incr ) ++ ( incr ) ++
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2 ( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
DUP2 LDA #00 NEQ ,&loop JCN DUP2 LDA #00 NEQ ,&loop JCN
@ -463,9 +463,9 @@ RTN
@line-vertical-dotted ( x y0 y1 color -- ) @line-vertical-dotted ( x y0 y1 color -- )
.color POK STH2 SWP2 .Screen/x DEO2 STH2r OVR2 .Screen/y DEO2 .color STZ STH2 SWP2 .Screen/x DEO2 STH2r OVR2 .Screen/y DEO2
&draw-ver &draw-ver
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
( incr ) SWP2 #0002 ADD2 DUP2 .Screen/y DEO2 SWP2 ( incr ) SWP2 #0002 ADD2 DUP2 .Screen/y DEO2 SWP2
OVR2 OVR2 LTH2 ,&draw-ver JCN OVR2 OVR2 LTH2 ,&draw-ver JCN
POP2 POP2 POP2 POP2
@ -474,9 +474,9 @@ RTN
@line-horizontal-dotted ( x0 x1 y color -- ) @line-horizontal-dotted ( x0 x1 y color -- )
.color POK .Screen/y DEO2 OVR2 .Screen/x DEO2 .color STZ .Screen/y DEO2 OVR2 .Screen/x DEO2
&draw-hor &draw-hor
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
( incr ) SWP2 #0002 ADD2 DUP2 .Screen/x DEO2 SWP2 ( incr ) SWP2 #0002 ADD2 DUP2 .Screen/x DEO2 SWP2
OVR2 OVR2 LTH2 ,&draw-hor JCN OVR2 OVR2 LTH2 ,&draw-hor JCN
POP2 POP2 POP2 POP2
@ -485,18 +485,18 @@ RTN
@line-rect ( x1 y1 x2 y2 color ) @line-rect ( x1 y1 x2 y2 color )
( load ) .color POK .rect/y2 POK2 .rect/x2 POK2 DUP2 .Screen/y DEO2 .rect/y1 POK2 DUP2 .Screen/x DEO2 .rect/x1 POK2 ( load ) .color STZ .rect/y2 STZ2 .rect/x2 STZ2 DUP2 .Screen/y DEO2 .rect/y1 STZ2 DUP2 .Screen/x DEO2 .rect/x1 STZ2
&hor &hor
( incr ) .Screen/x DEI2 ++ .Screen/x DEO2 ( incr ) .Screen/x DEI2 ++ .Screen/x DEO2
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO ( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO ( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .color LDZ .Screen/color DEO
.Screen/x DEI2 .rect/x2 PEK2 LTH2 ,&hor JCN .Screen/x DEI2 .rect/x2 LDZ2 LTH2 ,&hor JCN
.rect/y1 PEK2 .Screen/y DEO2 .rect/y1 LDZ2 .Screen/y DEO2
&ver &ver
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK .Screen/color DEO ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .color PEK .Screen/color DEO ( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .color LDZ .Screen/color DEO
( incr ) .Screen/y DEI2 ++ .Screen/y DEO2 ( incr ) .Screen/y DEI2 ++ .Screen/y DEO2
.Screen/y DEI2 .rect/y2 PEK2 ++ LTH2 ,&ver JCN .Screen/y DEI2 .rect/y2 LDZ2 ++ LTH2 ,&ver JCN
RTN RTN

View File

@ -61,29 +61,29 @@
;saw-path .File/name DEO2 #0100 .File/length DEO2 WAVEFORM #0500 ++ .File/load DEO2 ;saw-path .File/name DEO2 #0100 .File/length DEO2 WAVEFORM #0500 ++ .File/load DEO2
( find center ) ( find center )
.Screen/width DEI2 #0002 // .center/x POK2 .Screen/width DEI2 #0002 // .center/x STZ2
.Screen/height DEI2 #0002 // .center/y POK2 .Screen/height DEI2 #0002 // .center/y STZ2
( place octave ) ( place octave )
.center/x PEK2 #0080 -- .octave-view/x1 POK2 .center/x LDZ2 #0080 -- .octave-view/x1 STZ2
.center/y PEK2 #0008 ++ .octave-view/y1 POK2 .center/y LDZ2 #0008 ++ .octave-view/y1 STZ2
.octave-view/x1 PEK2 #0050 ++ .octave-view/x2 POK2 .octave-view/x1 LDZ2 #0050 ++ .octave-view/x2 STZ2
.octave-view/y1 PEK2 #0018 ++ .octave-view/y2 POK2 .octave-view/y1 LDZ2 #0018 ++ .octave-view/y2 STZ2
( place adsr ) ( place adsr )
.center/x PEK2 #0020 -- .adsr-view/x1 POK2 .center/x LDZ2 #0020 -- .adsr-view/x1 STZ2
.center/y PEK2 #0008 ++ .adsr-view/y1 POK2 .center/y LDZ2 #0008 ++ .adsr-view/y1 STZ2
.adsr-view/x1 PEK2 #00a0 ++ .adsr-view/x2 POK2 .adsr-view/x1 LDZ2 #00a0 ++ .adsr-view/x2 STZ2
.adsr-view/y1 PEK2 #0018 ++ .adsr-view/y2 POK2 .adsr-view/y1 LDZ2 #0018 ++ .adsr-view/y2 STZ2
( place waveform ) ( place waveform )
.center/x PEK2 #0080 -- .wave-view/x1 POK2 .center/x LDZ2 #0080 -- .wave-view/x1 STZ2
.center/y PEK2 #0020 -- .wave-view/y1 POK2 .center/y LDZ2 #0020 -- .wave-view/y1 STZ2
.wave-view/x1 PEK2 #0100 ++ .wave-view/x2 POK2 .wave-view/x1 LDZ2 #0100 ++ .wave-view/x2 STZ2
.wave-view/y1 PEK2 #0020 ++ .wave-view/y2 POK2 .wave-view/y1 LDZ2 #0020 ++ .wave-view/y2 STZ2
( default settings ) ( default settings )
#ff .last-note POK #ff .last-note STZ
#041c .Audio0/adsr DEO2 #041c .Audio0/adsr DEO2
#88 .Audio0/volume DEO #88 .Audio0/volume DEO
WAVEFORM .Audio0/addr DEO2 WAVEFORM .Audio0/addr DEO2
@ -98,13 +98,13 @@ BRK
@on-frame ( -> ) @on-frame ( -> )
.adsr-view/y2 PEK2 #0020 -- .Screen/y DEO2 .adsr-view/y2 LDZ2 #0020 -- .Screen/y DEO2
#00 #10 #00 #10
&loop &loop
.adsr-view/x2 PEK2 #003a -- .Screen/x DEO2 .adsr-view/x2 LDZ2 #003a -- .Screen/x DEO2
OVR #10 SWP - .Audio0/output DEI #0f AND < .Screen/color DEO OVR #10 SWP - .Audio0/output DEI #0f AND < .Screen/color DEO
.adsr-view/x2 PEK2 #003a -- #0002 ++ .Screen/x DEO2 .adsr-view/x2 LDZ2 #003a -- #0002 ++ .Screen/x DEO2
OVR #10 SWP - .Audio0/output DEI #04 SFT < .Screen/color DEO OVR #10 SWP - .Audio0/output DEI #04 SFT < .Screen/color DEO
.Screen/y DEI2 #0002 ++ .Screen/y DEO2 .Screen/y DEI2 #0002 ++ .Screen/y DEO2
( incr ) SWP #01 + SWP ( incr ) SWP #01 + SWP
@ -125,23 +125,23 @@ BRK
;draw-cursor JSR2 ;draw-cursor JSR2
.Mouse/state DEI #00 ! #01 JCN [ BRK ] .Mouse/state DEI #00 ! #01 JCN [ BRK ]
( wave-view ) ( wave-view )
.Mouse/x DEI2 DUP2 .wave-view/x1 PEK2 >> ROT ROT .wave-view/x2 PEK2 #0001 ++ << #0101 == .Mouse/x DEI2 DUP2 .wave-view/x1 LDZ2 >> ROT ROT .wave-view/x2 LDZ2 #0001 ++ << #0101 ==
.Mouse/y DEI2 DUP2 .wave-view/y1 PEK2 >> ROT ROT .wave-view/y2 PEK2 << #0101 == .Mouse/y DEI2 DUP2 .wave-view/y1 LDZ2 >> ROT ROT .wave-view/y2 LDZ2 << #0101 ==
#0101 == ;on-touch-wave-view JCN2 #0101 == ;on-touch-wave-view JCN2
( adsr-view ) ( adsr-view )
.Mouse/x DEI2 DUP2 .adsr-view/x1 PEK2 >> ROT ROT .adsr-view/x2 PEK2 << #0101 == .Mouse/x DEI2 DUP2 .adsr-view/x1 LDZ2 >> ROT ROT .adsr-view/x2 LDZ2 << #0101 ==
.Mouse/y DEI2 DUP2 .adsr-view/y1 PEK2 >> ROT ROT .adsr-view/y2 PEK2 << #0101 == .Mouse/y DEI2 DUP2 .adsr-view/y1 LDZ2 >> ROT ROT .adsr-view/y2 LDZ2 << #0101 ==
#0101 == ;on-touch-adsr-view JCN2 #0101 == ;on-touch-adsr-view JCN2
( octave-view ) ( octave-view )
.Mouse/x DEI2 DUP2 .octave-view/x1 PEK2 >> ROT ROT .octave-view/x2 PEK2 << #0101 == .Mouse/x DEI2 DUP2 .octave-view/x1 LDZ2 >> ROT ROT .octave-view/x2 LDZ2 << #0101 ==
.Mouse/y DEI2 DUP2 .octave-view/y1 PEK2 >> ROT ROT .octave-view/y2 PEK2 << #0101 == .Mouse/y DEI2 DUP2 .octave-view/y1 LDZ2 >> ROT ROT .octave-view/y2 LDZ2 << #0101 ==
#0101 == ;on-touch-octave-view JCN2 #0101 == ;on-touch-octave-view JCN2
BRK BRK
@on-touch-wave-view ( -> ) @on-touch-wave-view ( -> )
.Mouse/x DEI2 .wave-view/x1 PEK2 -- .Audio0/length DEO2 .Mouse/x DEI2 .wave-view/x1 LDZ2 -- .Audio0/length DEO2
;draw-wave JSR2 ;draw-wave JSR2
;draw-cursor JSR2 ;draw-cursor JSR2
@ -149,20 +149,20 @@ BRK
@on-touch-octave-view ( -> ) @on-touch-octave-view ( -> )
.Mouse/x DEI2 .octave-view/x1 PEK2 -- #0008 // SWP POP #09 ! ,&no-mod JCN .Mouse/x DEI2 .octave-view/x1 LDZ2 -- #0008 // SWP POP #09 ! ,&no-mod JCN
.Mouse/y DEI2 .octave-view/y1 PEK2 -- #0008 // SWP POP .Mouse/y DEI2 .octave-view/y1 LDZ2 -- #0008 // SWP POP
DUP #00 ! ,&no-incr JCN DUP #00 ! ,&no-incr JCN
.octave PEK #01 + .octave POK &no-incr .octave LDZ #01 + .octave STZ &no-incr
DUP #02 ! ,&no-decr JCN DUP #02 ! ,&no-decr JCN
.octave PEK #01 - .octave POK &no-decr .octave LDZ #01 - .octave STZ &no-decr
POP POP
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-octave JSR2 ;draw-octave JSR2
BRK BRK
&no-mod &no-mod
.Mouse/x DEI2 .octave-view/x1 PEK2 -- #0008 // SWP POP #06 > ,&no-key JCN .Mouse/x DEI2 .octave-view/x1 LDZ2 -- #0008 // SWP POP #06 > ,&no-key JCN
.Mouse/x DEI2 .octave-view/x1 PEK2 -- #0008 // DUP2 SWP POP .last-note POK ;notes ++ LDA ;play JSR2 .Mouse/x DEI2 .octave-view/x1 LDZ2 -- #0008 // DUP2 SWP POP .last-note STZ ;notes ++ LDA ;play JSR2
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-octave JSR2 ;draw-octave JSR2
&no-key &no-key
@ -171,7 +171,7 @@ BRK
@on-touch-adsr-view ( -> ) @on-touch-adsr-view ( -> )
.Mouse/x DEI2 .adsr-view/x1 PEK2 -- #0008 // SWP POP #03 / .Mouse/x DEI2 .adsr-view/x1 LDZ2 -- #0008 // SWP POP #03 /
DUP #00 ! ,&no-a JCN DUP #00 ! ,&no-a JCN
.Audio0/adsr DEI .Audio0/adsr DEI
#10 .Mouse/state DEI #10 = #e0 * + + #10 .Mouse/state DEI #10 = #e0 * + +
@ -208,27 +208,27 @@ BRK
( clear last cursor ) ( clear last cursor )
#fff8 .Screen/addr DEO2 #fff8 .Screen/addr DEO2
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
.Controller/key DEI .Controller/key DEI
DUP #61 ! ,&no-c JCN DUP #61 ! ,&no-c JCN
#00 .last-note POK ;notes LDA ;play JSR2 &no-c #00 .last-note STZ ;notes LDA ;play JSR2 &no-c
DUP #73 ! ,&no-d JCN DUP #73 ! ,&no-d JCN
#01 .last-note POK ;notes #0001 ++ LDA ;play JSR2 &no-d #01 .last-note STZ ;notes #0001 ++ LDA ;play JSR2 &no-d
DUP #64 ! ,&no-e JCN DUP #64 ! ,&no-e JCN
#02 .last-note POK ;notes #0002 ++ LDA ;play JSR2 &no-e #02 .last-note STZ ;notes #0002 ++ LDA ;play JSR2 &no-e
DUP #66 ! ,&no-f JCN DUP #66 ! ,&no-f JCN
#03 .last-note POK ;notes #0003 ++ LDA ;play JSR2 &no-f #03 .last-note STZ ;notes #0003 ++ LDA ;play JSR2 &no-f
DUP #67 ! ,&no-g JCN DUP #67 ! ,&no-g JCN
#04 .last-note POK ;notes #0004 ++ LDA ;play JSR2 &no-g #04 .last-note STZ ;notes #0004 ++ LDA ;play JSR2 &no-g
DUP #68 ! ,&no-a JCN DUP #68 ! ,&no-a JCN
#05 .last-note POK ;notes #0005 ++ LDA ;play JSR2 &no-a #05 .last-note STZ ;notes #0005 ++ LDA ;play JSR2 &no-a
DUP #6a ! ,&no-b JCN DUP #6a ! ,&no-b JCN
#06 .last-note POK ;notes #0006 ++ LDA ;play JSR2 &no-b #06 .last-note STZ ;notes #0006 ++ LDA ;play JSR2 &no-b
DUP #6b ! ,&no-c2 JCN DUP #6b ! ,&no-c2 JCN
#07 .last-note POK ;notes #0007 ++ LDA ;play JSR2 &no-c2 #07 .last-note STZ ;notes #0007 ++ LDA ;play JSR2 &no-c2
POP POP
.Controller/button DEI #f0 AND .Controller/button DEI #f0 AND
@ -249,7 +249,7 @@ BRK
@play ( pitch -- ) @play ( pitch -- )
DUP .octave PEK #0c * + .Audio0/pitch DEO DUP .octave LDZ #0c * + .Audio0/pitch DEO
RTN RTN
@ -257,15 +257,15 @@ RTN
( clear last cursor ) ( clear last cursor )
;cursor .Screen/addr DEO2 ;cursor .Screen/addr DEO2
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x POK2 .Mouse/x DEI2 .pointer/x STZ2
.Mouse/y DEI2 .pointer/y POK2 .Mouse/y DEI2 .pointer/y STZ2
( draw new cursor ) ( draw new cursor )
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
( colorize on state ) ( colorize on state )
#31 [ .Mouse/state DEI #00 ! ] + .Screen/color DEO #31 [ .Mouse/state DEI #00 ! ] + .Screen/color DEO
@ -273,28 +273,28 @@ RTN
@draw-octave ( -- ) @draw-octave ( -- )
.octave-view/x1 PEK2 .octave-view/y1 PEK2 .octave-view/x1 LDZ2 .octave-view/y1 LDZ2
OVR2 OVR2 ;keys-left-icns #21 .last-note PEK #00 = + ;draw-key JSR2 OVR2 OVR2 ;keys-left-icns #21 .last-note LDZ #00 = + ;draw-key JSR2
OVR2 #0008 ++ OVR2 ;keys-middle-icns #21 .last-note PEK #01 = + ;draw-key JSR2 OVR2 #0008 ++ OVR2 ;keys-middle-icns #21 .last-note LDZ #01 = + ;draw-key JSR2
OVR2 #0010 ++ OVR2 ;keys-right-icns #21 .last-note PEK #02 = + ;draw-key JSR2 OVR2 #0010 ++ OVR2 ;keys-right-icns #21 .last-note LDZ #02 = + ;draw-key JSR2
OVR2 #0018 ++ OVR2 ;keys-left-icns #21 .last-note PEK #03 = + ;draw-key JSR2 OVR2 #0018 ++ OVR2 ;keys-left-icns #21 .last-note LDZ #03 = + ;draw-key JSR2
OVR2 #0020 ++ OVR2 ;keys-middle-icns #21 .last-note PEK #04 = + ;draw-key JSR2 OVR2 #0020 ++ OVR2 ;keys-middle-icns #21 .last-note LDZ #04 = + ;draw-key JSR2
OVR2 #0028 ++ OVR2 ;keys-middle-icns #21 .last-note PEK #05 = + ;draw-key JSR2 OVR2 #0028 ++ OVR2 ;keys-middle-icns #21 .last-note LDZ #05 = + ;draw-key JSR2
SWP2 #0030 ++ SWP2 ;keys-right-icns #21 .last-note PEK #06 = + ;draw-key JSR2 SWP2 #0030 ++ SWP2 ;keys-right-icns #21 .last-note LDZ #06 = + ;draw-key JSR2
.octave-view/x1 PEK2 #0048 ++ .Screen/x DEO2 .octave-view/x1 LDZ2 #0048 ++ .Screen/x DEO2
;arrow-icns .Screen/addr DEO2 ;arrow-icns .Screen/addr DEO2
.octave-view/y1 PEK2 .Screen/y DEO2 .octave-view/y1 LDZ2 .Screen/y DEO2
#21 .Screen/color DEO #21 .Screen/color DEO
;arrow-icns #0008 ++ .Screen/addr DEO2 ;arrow-icns #0008 ++ .Screen/addr DEO2
.octave-view/y1 PEK2 #0010 ++ .Screen/y DEO2 .octave-view/y1 LDZ2 #0010 ++ .Screen/y DEO2
#21 .Screen/color DEO #21 .Screen/color DEO
;font-hex .octave PEK #03 + #00 SWP #0008 ** ++ .Screen/addr DEO2 ;font-hex .octave LDZ #03 + #00 SWP #0008 ** ++ .Screen/addr DEO2
.octave-view/y1 PEK2 #0008 ++ .Screen/y DEO2 .octave-view/y1 LDZ2 #0008 ++ .Screen/y DEO2
#23 .Screen/color DEO #23 .Screen/color DEO
RTN RTN
@ -319,23 +319,23 @@ RTN
@draw-adsr ( -- ) @draw-adsr ( -- )
( adsr ) ( adsr )
.adsr-view/x1 PEK2 .adsr-view/y1 PEK2 .adsr-view/x1 LDZ2 .adsr-view/y1 LDZ2
.Audio0/adsr DEI #04 SFT .Audio0/adsr DEI #04 SFT
;draw-knob JSR2 ;draw-knob JSR2
.adsr-view/x1 PEK2 #0018 ++ .adsr-view/y1 PEK2 .adsr-view/x1 LDZ2 #0018 ++ .adsr-view/y1 LDZ2
.Audio0/adsr DEI #0f AND .Audio0/adsr DEI #0f AND
;draw-knob JSR2 ;draw-knob JSR2
.adsr-view/x1 PEK2 #0030 ++ .adsr-view/y1 PEK2 .adsr-view/x1 LDZ2 #0030 ++ .adsr-view/y1 LDZ2
.Audio0/adsr #01 + DEI #04 SFT .Audio0/adsr #01 + DEI #04 SFT
;draw-knob JSR2 ;draw-knob JSR2
.adsr-view/x1 PEK2 #0048 ++ .adsr-view/y1 PEK2 .adsr-view/x1 LDZ2 #0048 ++ .adsr-view/y1 LDZ2
.Audio0/adsr #01 + DEI #0f AND .Audio0/adsr #01 + DEI #0f AND
;draw-knob JSR2 ;draw-knob JSR2
( volume ) ( volume )
.adsr-view/x2 PEK2 #0028 -- .adsr-view/y1 PEK2 .adsr-view/x2 LDZ2 #0028 -- .adsr-view/y1 LDZ2
.Audio0/volume DEI #04 SFT .Audio0/volume DEI #04 SFT
;draw-knob JSR2 ;draw-knob JSR2
.adsr-view/x2 PEK2 #0010 -- .adsr-view/y1 PEK2 .adsr-view/x2 LDZ2 #0010 -- .adsr-view/y1 LDZ2
.Audio0/volume DEI #0f AND .Audio0/volume DEI #0f AND
;draw-knob JSR2 ;draw-knob JSR2
@ -344,27 +344,27 @@ RTN
@draw-wave ( -- ) @draw-wave ( -- )
( clear ) ( clear )
.wave-view/x1 PEK2 .wave-view/x1 LDZ2
.wave-view/y1 PEK2 .wave-view/y1 LDZ2
.wave-view/x2 PEK2 #0001 ++ .wave-view/x2 LDZ2 #0001 ++
.wave-view/y2 PEK2 .wave-view/y2 LDZ2
#00 ;fill-rect JSR2 #00 ;fill-rect JSR2
#01 ;draw-wave-length JSR2 #01 ;draw-wave-length JSR2
.wave-view/x1 PEK2 .Screen/x DEO2 .wave-view/x1 LDZ2 .Screen/x DEO2
( waveform ) ( waveform )
#00 #ff #00 #ff
&loop &loop
( dotted line ) ( dotted line )
OVR #01 AND ,&no-dot JCN OVR #01 AND ,&no-dot JCN
.wave-view/y1 PEK2 #0010 ++ .Screen/y DEO2 .wave-view/y1 LDZ2 #0010 ++ .Screen/y DEO2
#03 .Screen/color DEO #03 .Screen/color DEO
&no-dot &no-dot
OVR TOS .Audio0/addr DEI2 ++ LDA OVR TOS .Audio0/addr DEI2 ++ LDA
#02 / #02 /
TOS #0004 // .wave-view/y1 PEK2 ++ .Screen/y DEO2 TOS #0004 // .wave-view/y1 LDZ2 ++ .Screen/y DEO2
.Screen/x DEI2 #0001 ++ .Screen/x DEO2 .Screen/x DEI2 #0001 ++ .Screen/x DEO2
( draw ) OVR .Audio0/length DEI2 SWP POP > #02 * #01 + .Screen/color DEO ( draw ) OVR .Audio0/length DEI2 SWP POP > #02 * #01 + .Screen/color DEO
( incr ) SWP #01 + SWP ( incr ) SWP #01 + SWP
@ -372,10 +372,10 @@ RTN
POP2 POP2
( range ) ( range )
.wave-view/x1 PEK2 .Screen/x DEO2 .wave-view/x1 LDZ2 .Screen/x DEO2
.wave-view/y1 PEK2 #0010 -- .Screen/y DEO2 .wave-view/y1 LDZ2 #0010 -- .Screen/y DEO2
.Audio0/addr DEI2 #22 ;draw-short JSR2 .Audio0/addr DEI2 #22 ;draw-short JSR2
.wave-view/x2 PEK2 #0020 -- .Screen/x DEO2 .wave-view/x2 LDZ2 #0020 -- .Screen/x DEO2
.Audio0/length DEI2 #22 ;draw-short JSR2 .Audio0/length DEI2 #22 ;draw-short JSR2
RTN RTN
@ -383,8 +383,8 @@ RTN
@draw-wave-length ( color -- ) @draw-wave-length ( color -- )
STH STH
.wave-view/x1 PEK2 .Audio0/length DEI2 ++ .Screen/x DEO2 .wave-view/x1 LDZ2 .Audio0/length DEI2 ++ .Screen/x DEO2
.wave-view/y1 PEK2 DUP2 #0020 ++ .wave-view/y1 LDZ2 DUP2 #0020 ++
&loop &loop
OVR2 .Screen/y DEO2 OVR2 .Screen/y DEO2
( draw ) DUPr STHr .Screen/color DEO ( draw ) DUPr STHr .Screen/color DEO
@ -439,14 +439,14 @@ RTN
@fill-rect ( x1* y1* x2* y2* color -- ) @fill-rect ( x1* y1* x2* y2* color -- )
.color POK .color STZ
( x1 x2 y1 y2 ) ROT2 SWP2 ( x1 x2 y1 y2 ) ROT2 SWP2
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
STH2 STH2 OVR2 OVR2 STH2 STH2 OVR2 OVR2
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
( incr ) SWP2 #0001 ++ SWP2 ( incr ) SWP2 #0001 ++ SWP2
OVR2 OVR2 LTS2 ,&hor JCN OVR2 OVR2 LTS2 ,&hor JCN
POP2 POP2 STH2r STH2r POP2 POP2 STH2r STH2r

View File

@ -28,8 +28,8 @@
#0caf .System/b DEO2 #0caf .System/b DEO2
( find center ) ( find center )
.Screen/width DEI2 #0002 / #0008 - .cat/x POK2 .Screen/width DEI2 #0002 / #0008 - .cat/x STZ2
.Screen/height DEI2 #0004 / #0003 * #0018 - .cat/y POK2 .Screen/height DEI2 #0004 / #0003 * #0018 - .cat/y STZ2
( vectors ) ( vectors )
;on-mouse .Mouse/vector DEO2 ;on-mouse .Mouse/vector DEO2
@ -44,15 +44,15 @@ BRK
;draw-cursor JSR2 ;draw-cursor JSR2
.Mouse/x DEI2 .cat/x PEK2 > #20 MUL .Mouse/x DEI2 .cat/x LDZ2 > #20 MUL
.Mouse/y DEI2 .cat/y PEK2 > #40 MUL .Mouse/y DEI2 .cat/y LDZ2 > #40 MUL
ADD #00 SWP ;draw-eye JSR2 ADD #00 SWP ;draw-eye JSR2
BRK BRK
@on-frame ( -> ) @on-frame ( -> )
.cat/timer PEK #01 ADD [ DUP ] .cat/timer POK .cat/timer LDZ #01 ADD [ DUP ] .cat/timer STZ
DUP #00 NEQ ,&skip0 JCN #0000 ;draw-tail JSR2 &skip0 DUP #00 NEQ ,&skip0 JCN #0000 ;draw-tail JSR2 &skip0
DUP #10 NEQ ,&skip1 JCN #0001 ;draw-tail JSR2 &skip1 DUP #10 NEQ ,&skip1 JCN #0001 ;draw-tail JSR2 &skip1
DUP #20 NEQ ,&skip2 JCN #0002 ;draw-tail JSR2 &skip2 DUP #20 NEQ ,&skip2 JCN #0002 ;draw-tail JSR2 &skip2
@ -66,8 +66,8 @@ BRK
@draw-polycat ( -- ) @draw-polycat ( -- )
( ears ) ( ears )
.cat/y PEK2 .Screen/y DEO2 .cat/y LDZ2 .Screen/y DEO2
.cat/x PEK2 DUP2 STH2 #0008 - .Screen/x DEO2 .cat/x LDZ2 DUP2 STH2 #0008 - .Screen/x DEO2
;ears .Screen/addr DEO2 ;ears .Screen/addr DEO2
#41 .Screen/color DEO #41 .Screen/color DEO
STH2r .Screen/x DEO2 STH2r .Screen/x DEO2
@ -81,8 +81,8 @@ RTN
@draw-eye ( quad* -- ) @draw-eye ( quad* -- )
.cat/y PEK2 #0008 + .Screen/y DEO2 .cat/y LDZ2 #0008 + .Screen/y DEO2
.cat/x PEK2 DUP2 STH2 #0008 - .Screen/x DEO2 .cat/x LDZ2 DUP2 STH2 #0008 - .Screen/x DEO2
DUP2 ;eye + .Screen/addr DEO2 DUP2 ;eye + .Screen/addr DEO2
( draw ) #41 .Screen/color DEO ( draw ) #41 .Screen/color DEO
STH2r .Screen/x DEO2 STH2r .Screen/x DEO2
@ -93,8 +93,8 @@ RTN
@draw-tail ( frame* -- ) @draw-tail ( frame* -- )
.cat/y PEK2 #0010 + .Screen/y DEO2 .cat/y LDZ2 #0010 + .Screen/y DEO2
.cat/x PEK2 DUP2 STH2 #0008 - .Screen/x DEO2 .cat/x LDZ2 DUP2 STH2 #0008 - .Screen/x DEO2
;body .Screen/addr DEO2 ;body .Screen/addr DEO2
( draw ) #41 .Screen/color DEO ( draw ) #41 .Screen/color DEO
STH2r .Screen/x DEO2 STH2r .Screen/x DEO2
@ -107,17 +107,17 @@ RTN
( clear last cursor ) ( clear last cursor )
;cursor .Screen/addr DEO2 ;cursor .Screen/addr DEO2
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x POK2 .Mouse/x DEI2 .pointer/x STZ2
.Mouse/y DEI2 .pointer/y POK2 .Mouse/y DEI2 .pointer/y STZ2
( draw new cursor ) ( draw new cursor )
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
( colorize on state ) ( colorize on state )
#31 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/color DEO #31 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/color DEO
@ -126,8 +126,8 @@ RTN
@draw-ground ( -- ) @draw-ground ( -- )
.cat/y PEK2 #0018 + .Screen/y DEO2 .cat/y LDZ2 #0018 + .Screen/y DEO2
.cat/x PEK2 #0010 - .Screen/x DEO2 .cat/x LDZ2 #0010 - .Screen/x DEO2
;ground .Screen/addr DEO2 ;ground .Screen/addr DEO2
#00 #10 #00 #10

View File

@ -44,21 +44,21 @@
;on-mouse .Mouse/vector DEO2 ;on-mouse .Mouse/vector DEO2
( size window ) ( size window )
#00b0 .window/w POK2 #00b0 .window/w STZ2
#0050 .window/h POK2 #0050 .window/h STZ2
( center window ) ( center window )
.Screen/width DEI2 2/ .window/w PEK2 2/ SUB2 .window/x1 POK2 .Screen/width DEI2 2/ .window/w LDZ2 2/ SUB2 .window/x1 STZ2
.Screen/height DEI2 2/ .window/h PEK2 2/ SUB2 .window/y1 POK2 .Screen/height DEI2 2/ .window/h LDZ2 2/ SUB2 .window/y1 STZ2
#01 .theme/r1 POK #02 .theme/g1 POK #03 .theme/b1 POK #01 .theme/r1 STZ #02 .theme/g1 STZ #03 .theme/b1 STZ
#04 .theme/r2 POK #06 .theme/g2 POK #07 .theme/b2 POK #04 .theme/r2 STZ #06 .theme/g2 STZ #07 .theme/b2 STZ
#0a .theme/r3 POK #09 .theme/g3 POK #08 .theme/b3 POK #0a .theme/r3 STZ #09 .theme/g3 STZ #08 .theme/b3 STZ
#0c .theme/r4 POK #0b .theme/g4 POK #0d .theme/b4 POK #0c .theme/r4 STZ #0b .theme/g4 STZ #0d .theme/b4 STZ
( find screen center ) ( find screen center )
.Screen/width DEI2 2/ .center/x POK2 .Screen/width DEI2 2/ .center/x STZ2
.Screen/height DEI2 2/ .center/y POK2 .Screen/height DEI2 2/ .center/y STZ2
;update-theme JSR2 ;update-theme JSR2
;draw-background JSR2 ;draw-background JSR2
@ -72,26 +72,26 @@ BRK
.Mouse/state DEI #00 NEQ #01 JCN [ BRK ] .Mouse/state DEI #00 NEQ #01 JCN [ BRK ]
.Mouse/y DEI2 .window/y1 PEK2 SUB2 STEP8 .Mouse/y DEI2 .window/y1 LDZ2 SUB2 STEP8
DUP2 #0010 NEQ2 ,&no-touch-red JCN DUP2 #0010 NEQ2 ,&no-touch-red JCN
.Mouse/x DEI2 .window/x1 PEK2 #0060 ADD2 LTH2 ,&no-touch-red JCN .Mouse/x DEI2 .window/x1 LDZ2 #0060 ADD2 LTH2 ,&no-touch-red JCN
.Mouse/x DEI2 .window/x1 PEK2 #009c ADD2 GTH2 ,&no-touch-red JCN .Mouse/x DEI2 .window/x1 LDZ2 #009c ADD2 GTH2 ,&no-touch-red JCN
( get new value ) .Mouse/x DEI2 .window/x1 PEK2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/r1 #00 .selection PEK ADD2 STA ( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/r1 #00 .selection LDZ ADD2 STA
&no-touch-red &no-touch-red
DUP2 #0020 NEQ2 ,&no-touch-green JCN DUP2 #0020 NEQ2 ,&no-touch-green JCN
.Mouse/x DEI2 .window/x1 PEK2 #0060 ADD2 LTH2 ,&no-touch-green JCN .Mouse/x DEI2 .window/x1 LDZ2 #0060 ADD2 LTH2 ,&no-touch-green JCN
.Mouse/x DEI2 .window/x1 PEK2 #009c ADD2 GTH2 ,&no-touch-green JCN .Mouse/x DEI2 .window/x1 LDZ2 #009c ADD2 GTH2 ,&no-touch-green JCN
( get new value ) .Mouse/x DEI2 .window/x1 PEK2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/g1 #00 .selection PEK ADD2 STA ( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/g1 #00 .selection LDZ ADD2 STA
&no-touch-green &no-touch-green
DUP2 #0030 NEQ2 ,&no-touch-blue JCN DUP2 #0030 NEQ2 ,&no-touch-blue JCN
.Mouse/x DEI2 .window/x1 PEK2 #0060 ADD2 LTH2 ,&no-touch-blue JCN .Mouse/x DEI2 .window/x1 LDZ2 #0060 ADD2 LTH2 ,&no-touch-blue JCN
.Mouse/x DEI2 .window/x1 PEK2 #009c ADD2 GTH2 ,&no-touch-blue JCN .Mouse/x DEI2 .window/x1 LDZ2 #009c ADD2 GTH2 ,&no-touch-blue JCN
( get new value ) .Mouse/x DEI2 .window/x1 PEK2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/b1 #00 .selection PEK ADD2 STA ( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/b1 #00 .selection LDZ ADD2 STA
&no-touch-blue &no-touch-blue
DUP2 #0040 NEQ2 ,&no-touch-radio JCN DUP2 #0040 NEQ2 ,&no-touch-radio JCN
.Mouse/x DEI2 .window/x1 PEK2 #0050 ADD2 LTH2 ,&no-touch-radio JCN .Mouse/x DEI2 .window/x1 LDZ2 #0050 ADD2 LTH2 ,&no-touch-radio JCN
.Mouse/x DEI2 .window/x1 PEK2 #008c ADD2 GTH2 ,&no-touch-radio JCN .Mouse/x DEI2 .window/x1 LDZ2 #008c ADD2 GTH2 ,&no-touch-radio JCN
.Mouse/x DEI2 .window/x1 PEK2 SUB2 #0050 SUB2 STEP8 2/ #0008 DIV2 SWP POP .selection POK .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0050 SUB2 STEP8 2/ #0008 DIV2 SWP POP .selection STZ
&no-touch-radio &no-touch-radio
POP2 POP2
@ -102,25 +102,25 @@ BRK
@update-theme ( -- ) @update-theme ( -- )
#08 DEI #0f AND .theme/r1 PEK #40 SFT ADD #08 DEO #08 DEI #0f AND .theme/r1 LDZ #40 SFT ADD #08 DEO
#0a DEI #0f AND .theme/g1 PEK #40 SFT ADD #0a DEO #0a DEI #0f AND .theme/g1 LDZ #40 SFT ADD #0a DEO
#0c DEI #0f AND .theme/b1 PEK #40 SFT ADD #0c DEO #0c DEI #0f AND .theme/b1 LDZ #40 SFT ADD #0c DEO
#08 DEI #f0 AND .theme/r2 PEK ADD #08 DEO #08 DEI #f0 AND .theme/r2 LDZ ADD #08 DEO
#0a DEI #f0 AND .theme/g2 PEK ADD #0a DEO #0a DEI #f0 AND .theme/g2 LDZ ADD #0a DEO
#0c DEI #f0 AND .theme/b2 PEK ADD #0c DEO #0c DEI #f0 AND .theme/b2 LDZ ADD #0c DEO
#09 DEI #0f AND .theme/r3 PEK #40 SFT ADD #09 DEO #09 DEI #0f AND .theme/r3 LDZ #40 SFT ADD #09 DEO
#0b DEI #0f AND .theme/g3 PEK #40 SFT ADD #0b DEO #0b DEI #0f AND .theme/g3 LDZ #40 SFT ADD #0b DEO
#0d DEI #0f AND .theme/b3 PEK #40 SFT ADD #0d DEO #0d DEI #0f AND .theme/b3 LDZ #40 SFT ADD #0d DEO
#09 DEI #f0 AND .theme/r4 PEK ADD #09 DEO #09 DEI #f0 AND .theme/r4 LDZ ADD #09 DEO
#0b DEI #f0 AND .theme/g4 PEK ADD #0b DEO #0b DEI #f0 AND .theme/g4 LDZ ADD #0b DEO
#0d DEI #f0 AND .theme/b4 PEK ADD #0d DEO #0d DEI #f0 AND .theme/b4 LDZ ADD #0d DEO
RTN RTN
@draw-background ( -- ) @draw-background ( -- )
( draw hor line ) ( draw hor line )
#0000 .Screen/x DEO2 .center/y PEK2 .Screen/y DEO2 #0000 .Screen/x DEO2 .center/y LDZ2 .Screen/y DEO2
#0000 .Screen/width DEI2 ( from/to ) #0000 .Screen/width DEI2 ( from/to )
&draw-hor &draw-hor
( draw ) #01 .Screen/color DEO ( draw ) #01 .Screen/color DEO
@ -129,7 +129,7 @@ RTN
POP2 POP2 POP2 POP2
( draw ver line ) ( draw ver line )
.center/x PEK2 .Screen/x DEO2 #0000 .Screen/y DEO2 .center/x LDZ2 .Screen/x DEO2 #0000 .Screen/y DEO2
#0000 .Screen/height DEI2 ( from/to ) #0000 .Screen/height DEI2 ( from/to )
&draw-ver &draw-ver
( draw ) #02 .Screen/color DEO ( draw ) #02 .Screen/color DEO
@ -192,46 +192,46 @@ RTN
@draw-window ( -- ) @draw-window ( -- )
.window/x1 PEK2 .window/w PEK2 ADD2 .window/x2 POK2 .window/x1 LDZ2 .window/w LDZ2 ADD2 .window/x2 STZ2
.window/y1 PEK2 .window/h PEK2 ADD2 .window/y2 POK2 .window/y1 LDZ2 .window/h LDZ2 ADD2 .window/y2 STZ2
.window/x1 PEK2 .window/y1 PEK2 .window/x2 PEK2 .window/y2 PEK2 #02 ;fill-rect JSR2 .window/x1 LDZ2 .window/y1 LDZ2 .window/x2 LDZ2 .window/y2 LDZ2 #02 ;fill-rect JSR2
.window/x1 PEK2 .window/y1 PEK2 .window/x2 PEK2 .window/y2 PEK2 #01 ;line-rect JSR2 .window/x1 LDZ2 .window/y1 LDZ2 .window/x2 LDZ2 .window/y2 LDZ2 #01 ;line-rect JSR2
.window/x1 PEK2 #0002 SUB2 .window/y1 PEK2 #0002 SUB2 .window/x2 PEK2 #0002 ADD2 .window/y2 PEK2 #0002 ADD2 #01 ;line-rect JSR2 .window/x1 LDZ2 #0002 SUB2 .window/y1 LDZ2 #0002 SUB2 .window/x2 LDZ2 #0002 ADD2 .window/y2 LDZ2 #0002 ADD2 #01 ;line-rect JSR2
.window/x1 PEK2 #0008 ADD2 .window/y1 PEK2 #0010 ADD2 ;red_txt #25 ;draw-label JSR2 .window/x1 LDZ2 #0008 ADD2 .window/y1 LDZ2 #0010 ADD2 ;red_txt #25 ;draw-label JSR2
.window/x1 PEK2 #0038 ADD2 .Screen/x DEO2 .window/x1 LDZ2 #0038 ADD2 .Screen/x DEO2
.System/r DEI2 #28 ;draw-short JSR2 .System/r DEI2 #28 ;draw-short JSR2
.window/x1 PEK2 #0008 ADD2 .window/y1 PEK2 #0020 ADD2 ;green_txt #25 ;draw-label JSR2 .window/x1 LDZ2 #0008 ADD2 .window/y1 LDZ2 #0020 ADD2 ;green_txt #25 ;draw-label JSR2
.window/x1 PEK2 #0038 ADD2 .Screen/x DEO2 .window/x1 LDZ2 #0038 ADD2 .Screen/x DEO2
.System/g DEI2 #28 ;draw-short JSR2 .System/g DEI2 #28 ;draw-short JSR2
.window/x1 PEK2 #0008 ADD2 .window/y1 PEK2 #0030 ADD2 ;blue_txt #25 ;draw-label JSR2 .window/x1 LDZ2 #0008 ADD2 .window/y1 LDZ2 #0030 ADD2 ;blue_txt #25 ;draw-label JSR2
.window/x1 PEK2 #0038 ADD2 .Screen/x DEO2 .window/x1 LDZ2 #0038 ADD2 .Screen/x DEO2
.System/b DEI2 #28 ;draw-short JSR2 .System/b DEI2 #28 ;draw-short JSR2
.window/x1 PEK2 #0060 ADD2 .window/y1 PEK2 #0010 ADD2 .window/x1 PEK2 #0090 ADD2 #00 ;theme/r1 .selection PEK ADD LDA #0004 MUL2 #01 ;draw-slider JSR2 .window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0010 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/r1 .selection LDZ ADD LDA #0004 MUL2 #01 ;draw-slider JSR2
.window/x1 PEK2 #0060 ADD2 .window/y1 PEK2 #0020 ADD2 .window/x1 PEK2 #0090 ADD2 #00 ;theme/g1 .selection PEK ADD LDA #0004 MUL2 #01 ;draw-slider JSR2 .window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0020 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/g1 .selection LDZ ADD LDA #0004 MUL2 #01 ;draw-slider JSR2
.window/x1 PEK2 #0060 ADD2 .window/y1 PEK2 #0030 ADD2 .window/x1 PEK2 #0090 ADD2 #00 ;theme/b1 .selection PEK ADD LDA #0004 MUL2 #01 ;draw-slider JSR2 .window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0030 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/b1 .selection LDZ ADD LDA #0004 MUL2 #01 ;draw-slider JSR2
.window/x1 PEK2 #0050 ADD2 .Screen/x DEO2 .window/x1 LDZ2 #0050 ADD2 .Screen/x DEO2
.window/y1 PEK2 #0040 ADD2 .Screen/y DEO2 .window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2
;radio_icns #00 .selection PEK #00 EQU #0008 MUL2 ADD2 .Screen/addr DEO2 ;radio_icns #00 .selection LDZ #00 EQU #0008 MUL2 ADD2 .Screen/addr DEO2
#25 .Screen/color DEO #25 .Screen/color DEO
.window/x1 PEK2 #0060 ADD2 .Screen/x DEO2 .window/x1 LDZ2 #0060 ADD2 .Screen/x DEO2
.window/y1 PEK2 #0040 ADD2 .Screen/y DEO2 .window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2
;radio_icns #00 .selection PEK #01 EQU #0008 MUL2 ADD2 .Screen/addr DEO2 ;radio_icns #00 .selection LDZ #01 EQU #0008 MUL2 ADD2 .Screen/addr DEO2
#25 .Screen/color DEO #25 .Screen/color DEO
.window/x1 PEK2 #0070 ADD2 .Screen/x DEO2 .window/x1 LDZ2 #0070 ADD2 .Screen/x DEO2
.window/y1 PEK2 #0040 ADD2 .Screen/y DEO2 .window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2
;radio_icns #00 .selection PEK #02 EQU #0008 MUL2 ADD2 .Screen/addr DEO2 ;radio_icns #00 .selection LDZ #02 EQU #0008 MUL2 ADD2 .Screen/addr DEO2
#25 .Screen/color DEO #25 .Screen/color DEO
.window/x1 PEK2 #0080 ADD2 .Screen/x DEO2 .window/x1 LDZ2 #0080 ADD2 .Screen/x DEO2
.window/y1 PEK2 #0040 ADD2 .Screen/y DEO2 .window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2
;radio_icns #00 .selection PEK #03 EQU #0008 MUL2 ADD2 .Screen/addr DEO2 ;radio_icns #00 .selection LDZ #03 EQU #0008 MUL2 ADD2 .Screen/addr DEO2
#25 .Screen/color DEO #25 .Screen/color DEO
RTN RTN
@ -240,27 +240,27 @@ RTN
( clear last cursor ) ( clear last cursor )
;pointer_icn .Screen/addr DEO2 ;pointer_icn .Screen/addr DEO2
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x POK2 .Mouse/x DEI2 .pointer/x STZ2
.Mouse/y DEI2 .pointer/y POK2 .Mouse/y DEI2 .pointer/y STZ2
( draw new cursor ) ( draw new cursor )
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#33 .Mouse/state DEI #00 NEQ #02 MUL SUB .Screen/color DEO #33 .Mouse/state DEI #00 NEQ #02 MUL SUB .Screen/color DEO
RTN RTN
@draw-slider ( x1* y* x2* pos* color -- ) @draw-slider ( x1* y* x2* pos* color -- )
( load ) .color POK .slider/pos POK2 .slider/x2 POK2 .slider/y POK2 .slider/x1 POK2 ( load ) .color STZ .slider/pos STZ2 .slider/x2 STZ2 .slider/y STZ2 .slider/x1 STZ2
.slider/x1 PEK2 .Screen/x DEO2 .slider/x1 LDZ2 .Screen/x DEO2
.slider/y PEK2 .Screen/y DEO2 .slider/y LDZ2 .Screen/y DEO2
;halftone_icn .Screen/addr DEO2 ;halftone_icn .Screen/addr DEO2
;slidera_icn .Screen/addr DEO2 ;slidera_icn .Screen/addr DEO2
@ -270,13 +270,13 @@ RTN
&loop &loop
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2 ( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( draw ) #25 .Screen/color DEO ( draw ) #25 .Screen/color DEO
.Screen/x DEI2 .slider/x2 PEK2 #0008 ADD2 LTH2 ,&loop JCN .Screen/x DEI2 .slider/x2 LDZ2 #0008 ADD2 LTH2 ,&loop JCN
( incr ) .Screen/x DEI2 #0004 ADD2 .Screen/x DEO2 ( incr ) .Screen/x DEI2 #0004 ADD2 .Screen/x DEO2
;sliderc_icn .Screen/addr DEO2 ;sliderc_icn .Screen/addr DEO2
( draw ) #25 .Screen/color DEO ( draw ) #25 .Screen/color DEO
.slider/x1 PEK2 .slider/pos PEK2 ADD2 .Screen/x DEO2 .slider/x1 LDZ2 .slider/pos LDZ2 ADD2 .Screen/x DEO2
;sliderd_icn .Screen/addr DEO2 ;sliderd_icn .Screen/addr DEO2
( draw ) #2a .Screen/color DEO ( draw ) #2a .Screen/color DEO
@ -284,14 +284,14 @@ RTN
@fill-rect ( x1* y1* x2* y2* color -- ) @fill-rect ( x1* y1* x2* y2* color -- )
.color POK .color STZ
( x1 x2 y1 y2 ) ROT2 SWP2 ( x1 x2 y1 y2 ) ROT2 SWP2
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
STH2 STH2 OVR2 OVR2 STH2 STH2 OVR2 OVR2
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
( incr ) SWP2 #0001 ADD2 SWP2 ( incr ) SWP2 #0001 ADD2 SWP2
OVR2 OVR2 LTH2 ,&hor JCN OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2 STH2r STH2r POP2 POP2 STH2r STH2r
@ -303,18 +303,18 @@ RTN
@line-rect ( x1* y1* x2* y2* color -- ) @line-rect ( x1* y1* x2* y2* color -- )
( load ) .color POK .rect/y2 POK2 .rect/x2 POK2 DUP2 .Screen/y DEO2 .rect/y1 POK2 DUP2 .Screen/x DEO2 .rect/x1 POK2 ( load ) .color STZ .rect/y2 STZ2 .rect/x2 STZ2 DUP2 .Screen/y DEO2 .rect/y1 STZ2 DUP2 .Screen/x DEO2 .rect/x1 STZ2
&hor &hor
( incr ) .Screen/x DEI2 ++ .Screen/x DEO2 ( incr ) .Screen/x DEI2 ++ .Screen/x DEO2
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO ( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO ( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .color LDZ .Screen/color DEO
.Screen/x DEI2 .rect/x2 PEK2 LTH2 ,&hor JCN .Screen/x DEI2 .rect/x2 LDZ2 LTH2 ,&hor JCN
.rect/y1 PEK2 .Screen/y DEO2 .rect/y1 LDZ2 .Screen/y DEO2
&ver &ver
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK .Screen/color DEO ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .color PEK .Screen/color DEO ( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .color LDZ .Screen/color DEO
( incr ) .Screen/y DEI2 ++ .Screen/y DEO2 ( incr ) .Screen/y DEI2 ++ .Screen/y DEO2
.Screen/y DEI2 .rect/y2 PEK2 ++ LTH2 ,&ver JCN .Screen/y DEI2 .rect/y2 LDZ2 ++ LTH2 ,&ver JCN
RTN RTN

View File

@ -31,11 +31,11 @@ BRK
@on-frame ( -> ) @on-frame ( -> )
( incr ) .timer PEK #01 ADD .timer POK ( incr ) .timer LDZ #01 ADD .timer STZ
( skip ) .timer PEK #10 EQU #01 JCN [ BRK ] ( skip ) .timer LDZ #10 EQU #01 JCN [ BRK ]
( get note ) ( get note )
;melody #00 .progress PEK ADD2 LDA ;melody #00 .progress LDZ ADD2 LDA
( play note ) ( play note )
DUP .Audio0/pitch DEO DUP .Audio0/pitch DEO
@ -45,13 +45,13 @@ BRK
( draw note ) ( draw note )
#00 SWP #0004 MUL2 #0100 SUB2 .Screen/y DEO2 #00 SWP #0004 MUL2 #0100 SUB2 .Screen/y DEO2
#00 .progress PEK #0008 MUL2 .Screen/x DEO2 #00 .progress LDZ #0008 MUL2 .Screen/x DEO2
;dot .Screen/addr DEO2 ;dot .Screen/addr DEO2
#21 .Screen/color DEO #21 .Screen/color DEO
( incr ) .progress PEK #01 ADD #20 MOD .progress POK ( incr ) .progress LDZ #01 ADD #20 MOD .progress STZ
#00 .timer POK #00 .timer STZ
BRK BRK

View File

@ -58,23 +58,23 @@ RTN
RTN RTN
@print-decimal ( short -- ) @print-decimal ( short -- )
#00 .number/started POK #00 .number/started STZ
DUP2 #2710 DIV2 DUP2 ,&digit JSR #2710 MUL2 SUB2 DUP2 #2710 DIV2 DUP2 ,&digit JSR #2710 MUL2 SUB2
DUP2 #03e8 DIV2 DUP2 ,&digit JSR #03e8 MUL2 SUB2 DUP2 #03e8 DIV2 DUP2 ,&digit JSR #03e8 MUL2 SUB2
DUP2 #0064 DIV2 DUP2 ,&digit JSR #0064 MUL2 SUB2 DUP2 #0064 DIV2 DUP2 ,&digit JSR #0064 MUL2 SUB2
DUP2 #000a DIV2 DUP2 ,&digit JSR #000a MUL2 SUB2 DUP2 #000a DIV2 DUP2 ,&digit JSR #000a MUL2 SUB2
,&digit JSR ,&digit JSR
.number/started PEK ,&end JCN .number/started LDZ ,&end JCN
LIT '0 .Console/char DEO LIT '0 .Console/char DEO
&end &end
RTN RTN
&digit &digit
SWP POP SWP POP
DUP .number/started PEK ORA #02 JCN DUP .number/started LDZ ORA #02 JCN
POP JMP2r POP JMP2r
LIT '0 ADD .Console/char DEO LIT '0 ADD .Console/char DEO
#01 .number/started POK #01 .number/started STZ
RTN RTN
@char-txt "char: 20 $1 @char-txt "char: 20 $1

View File

@ -33,19 +33,19 @@
;default_icn .Screen/addr DEO2 ;default_icn .Screen/addr DEO2
#31 .Screen/color DEO #31 .Screen/color DEO
#2a .slime POK #2a .slime STZ
BRK BRK
@on-frame ( -> ) @on-frame ( -> )
#2a .slime POK #2a .slime STZ
;default_icn .Screen/addr DEO2 ;default_icn .Screen/addr DEO2
( hold ctrl key to change slime color ) ( hold ctrl key to change slime color )
.Controller/button DEI #0f AND .Controller/button DEI #0f AND
DUP #01 NEQ ,&no-ctrl JCN #25 .slime POK &no-ctrl DUP #01 NEQ ,&no-ctrl JCN #25 .slime STZ &no-ctrl
DUP #02 NEQ ,&no-alt JCN #2f .slime POK &no-alt DUP #02 NEQ ,&no-alt JCN #2f .slime STZ &no-alt
POP POP
( clear ) #30 .Screen/color DEO ( clear ) #30 .Screen/color DEO
@ -75,7 +75,7 @@ BRK
( draw slime ) ( draw slime )
;slime_icn .Screen/addr DEO2 ;slime_icn .Screen/addr DEO2
.slime PEK .Screen/color DEO .slime LDZ .Screen/color DEO
BRK BRK

View File

@ -41,30 +41,30 @@ BRK
@on-frame ( -> ) @on-frame ( -> )
( only draw once per second ) ( only draw once per second )
( skip ) .DateTime/second DEI .current PEK NEQ #01 JCN [ BRK ] ( skip ) .DateTime/second DEI .current LDZ NEQ #01 JCN [ BRK ]
.DateTime/second DEI .current POK .DateTime/second DEI .current STZ
( clear ) ( clear )
#0080 SCALEX #0080 SCALEY .needles/sx PEK2 .needles/sy PEK2 #00 ;draw-line JSR2 #0080 SCALEX #0080 SCALEY .needles/sx LDZ2 .needles/sy LDZ2 #00 ;draw-line JSR2
#0080 SCALEX #0080 SCALEY .needles/mx PEK2 .needles/my PEK2 #00 ;draw-line JSR2 #0080 SCALEX #0080 SCALEY .needles/mx LDZ2 .needles/my LDZ2 #00 ;draw-line JSR2
#0080 SCALEX #0080 SCALEY .needles/hx PEK2 .needles/hy PEK2 #00 ;draw-line JSR2 #0080 SCALEX #0080 SCALEY .needles/hx LDZ2 .needles/hy LDZ2 #00 ;draw-line JSR2
( place ) ( place )
#00 .DateTime/second DEI #0002 MUL2 ;table ADD2 LDA2 #00 .DateTime/second DEI #0002 MUL2 ;table ADD2 LDA2
#00 SWP SCALEY .needles/sy POK2 #00 SWP SCALEY .needles/sy STZ2
#00 SWP SCALEX .needles/sx POK2 #00 SWP SCALEX .needles/sx STZ2
#00 .DateTime/minute DEI #0002 MUL2 ;table ADD2 LDA2 #00 .DateTime/minute DEI #0002 MUL2 ;table ADD2 LDA2
#00 SWP #0004 DIV2 #0003 MUL2 #0020 ADD2 SCALEY .needles/my POK2 #00 SWP #0004 DIV2 #0003 MUL2 #0020 ADD2 SCALEY .needles/my STZ2
#00 SWP #0004 DIV2 #0003 MUL2 #0020 ADD2 SCALEX .needles/mx POK2 #00 SWP #0004 DIV2 #0003 MUL2 #0020 ADD2 SCALEX .needles/mx STZ2
#00 .DateTime/hour DEI 12HOURS #05 MUL #0002 MUL2 ;table ADD2 LDA2 #00 .DateTime/hour DEI 12HOURS #05 MUL #0002 MUL2 ;table ADD2 LDA2
#00 SWP #0002 DIV2 #0040 ADD2 SCALEY .needles/hy POK2 #00 SWP #0002 DIV2 #0040 ADD2 SCALEY .needles/hy STZ2
#00 SWP #0002 DIV2 #0040 ADD2 SCALEX .needles/hx POK2 #00 SWP #0002 DIV2 #0040 ADD2 SCALEX .needles/hx STZ2
( needles ) ( needles )
#0080 SCALEX #0080 SCALEY .needles/sx PEK2 .needles/sy PEK2 #02 ;draw-line JSR2 #0080 SCALEX #0080 SCALEY .needles/sx LDZ2 .needles/sy LDZ2 #02 ;draw-line JSR2
#0080 SCALEX #0080 SCALEY .needles/mx PEK2 .needles/my PEK2 #01 ;draw-line JSR2 #0080 SCALEX #0080 SCALEY .needles/mx LDZ2 .needles/my LDZ2 #01 ;draw-line JSR2
#0080 SCALEX #0080 SCALEY .needles/hx PEK2 .needles/hy PEK2 #03 ;draw-line JSR2 #0080 SCALEX #0080 SCALEY .needles/hx LDZ2 .needles/hy LDZ2 #03 ;draw-line JSR2
( circle ) ( circle )
#00 #3c #00 #3c
@ -109,26 +109,26 @@ RTN
@draw-line ( x1 y1 x2 y2 color -- ) @draw-line ( x1 y1 x2 y2 color -- )
( load ) .color POK .line/y0 POK2 .line/x0 POK2 .line/y POK2 .line/x POK2 ( load ) .color STZ .line/y0 STZ2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2
.line/x0 PEK2 .line/x PEK2 SUB2 ABS2 .line/dx POK2 .line/x0 LDZ2 .line/x LDZ2 SUB2 ABS2 .line/dx STZ2
.line/y0 PEK2 .line/y PEK2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy POK2 .line/y0 LDZ2 .line/y LDZ2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy STZ2
#ffff #00 .line/x PEK2 .line/x0 PEK2 LTS2 #0002 MUL2 ADD2 .line/sx POK2 #ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sx STZ2
#ffff #00 .line/y PEK2 .line/y0 PEK2 LTS2 #0002 MUL2 ADD2 .line/sy POK2 #ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sy STZ2
.line/dx PEK2 .line/dy PEK2 ADD2 .line/e1 POK2 .line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
&loop &loop
.line/x PEK2 .Screen/x DEO2 .line/x LDZ2 .Screen/x DEO2
.line/y PEK2 .Screen/y DEO2 .line/y LDZ2 .Screen/y DEO2
.color PEK .Screen/color DEO .color LDZ .Screen/color DEO
[ .line/x PEK2 .line/x0 PEK2 EQU2 ] [ .line/x LDZ2 .line/x0 LDZ2 EQU2 ]
[ .line/y PEK2 .line/y0 PEK2 EQU2 ] #0101 EQU2 ,&end JCN [ .line/y LDZ2 .line/y0 LDZ2 EQU2 ] #0101 EQU2 ,&end JCN
.line/e1 PEK2 #0002 MUL2 .line/e2 POK2 .line/e1 LDZ2 #0002 MUL2 .line/e2 STZ2
.line/e2 PEK2 .line/dy PEK2 LTS2 ,&skipy JCN .line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN
.line/e1 PEK2 .line/dy PEK2 ADD2 .line/e1 POK2 .line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
.line/x PEK2 .line/sx PEK2 ADD2 .line/x POK2 .line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2
&skipy &skipy
.line/e2 PEK2 .line/dx PEK2 GTS2 ,&skipx JCN .line/e2 LDZ2 .line/dx LDZ2 GTS2 ,&skipx JCN
.line/e1 PEK2 .line/dx PEK2 ADD2 .line/e1 POK2 .line/e1 LDZ2 .line/dx LDZ2 ADD2 .line/e1 STZ2
.line/y PEK2 .line/sy PEK2 ADD2 .line/y POK2 .line/y LDZ2 .line/sy LDZ2 ADD2 .line/y STZ2
&skipx &skipx
;&loop JMP2 ;&loop JMP2
&end &end

View File

@ -36,37 +36,37 @@ BRK
;draw-cursor JSR2 ;draw-cursor JSR2
( on down ) ( on down )
.Mouse/state DEI #00 NEQ .pointer/state PEK #00 EQU #0101 EQU2 ,on-mouse-down JCN .Mouse/state DEI #00 NEQ .pointer/state LDZ #00 EQU #0101 EQU2 ,on-mouse-down JCN
( on drag ) ( on drag )
.Mouse/state DEI #00 NEQ ,on-mouse-drag JCN .Mouse/state DEI #00 NEQ ,on-mouse-drag JCN
.Mouse/state DEI .pointer/state POK .Mouse/state DEI .pointer/state STZ
BRK BRK
@on-mouse-down ( -> ) @on-mouse-down ( -> )
( record start position ) ( record start position )
.Mouse/x DEI2 DUP2 .pointer/x POK2 .pointer/lastx POK2 .Mouse/x DEI2 DUP2 .pointer/x STZ2 .pointer/lastx STZ2
.Mouse/y DEI2 DUP2 .pointer/y POK2 .pointer/lasty POK2 .Mouse/y DEI2 DUP2 .pointer/y STZ2 .pointer/lasty STZ2
.Mouse/state DEI .pointer/state POK .Mouse/state DEI .pointer/state STZ
BRK BRK
@on-mouse-drag ( -> ) @on-mouse-drag ( -> )
( draw line ) ( draw line )
.pointer/lastx PEK2 .pointer/lastx LDZ2
.pointer/lasty PEK2 .pointer/lasty LDZ2
.pointer/x PEK2 .pointer/x LDZ2
.pointer/y PEK2 .pointer/y LDZ2
#01 [ .Mouse/state DEI #10 EQU #02 MUL ADD ] #01 [ .Mouse/state DEI #10 EQU #02 MUL ADD ]
;draw-line JSR2 ;draw-line JSR2
( record last position ) ( record last position )
.Mouse/x DEI2 .pointer/lastx POK2 .Mouse/x DEI2 .pointer/lastx STZ2
.Mouse/y DEI2 .pointer/lasty POK2 .Mouse/y DEI2 .pointer/lasty STZ2
.Mouse/state DEI .pointer/state POK .Mouse/state DEI .pointer/state STZ
BRK BRK
@ -74,44 +74,44 @@ BRK
( clear last cursor ) ( clear last cursor )
#fff8 .Screen/addr DEO2 #fff8 .Screen/addr DEO2
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x POK2 .Mouse/x DEI2 .pointer/x STZ2
.Mouse/y DEI2 .pointer/y POK2 .Mouse/y DEI2 .pointer/y STZ2
( draw new cursor ) ( draw new cursor )
;pointer_icn .Screen/addr DEO2 ;pointer_icn .Screen/addr DEO2
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#33 .Mouse/state DEI #00 NEQ #02 MUL SUB .Screen/color DEO #33 .Mouse/state DEI #00 NEQ #02 MUL SUB .Screen/color DEO
RTN RTN
@draw-line ( x1 y1 x2 y2 color -- ) @draw-line ( x1 y1 x2 y2 color -- )
( load ) .color POK .line/y0 POK2 .line/x0 POK2 .line/y POK2 .line/x POK2 ( load ) .color STZ .line/y0 STZ2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2
.line/x0 PEK2 .line/x PEK2 SUB2 ABS2 .line/dx POK2 .line/x0 LDZ2 .line/x LDZ2 SUB2 ABS2 .line/dx STZ2
.line/y0 PEK2 .line/y PEK2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy POK2 .line/y0 LDZ2 .line/y LDZ2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy STZ2
#ffff #00 .line/x PEK2 .line/x0 PEK2 LTS2 #0002 MUL2 ADD2 .line/sx POK2 #ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sx STZ2
#ffff #00 .line/y PEK2 .line/y0 PEK2 LTS2 #0002 MUL2 ADD2 .line/sy POK2 #ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sy STZ2
.line/dx PEK2 .line/dy PEK2 ADD2 .line/e1 POK2 .line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
&loop &loop
.line/x PEK2 .Screen/x DEO2 .line/x LDZ2 .Screen/x DEO2
.line/y PEK2 .Screen/y DEO2 .line/y LDZ2 .Screen/y DEO2
.color PEK .Screen/color DEO .color LDZ .Screen/color DEO
[ .line/x PEK2 .line/x0 PEK2 EQU2 ] [ .line/x LDZ2 .line/x0 LDZ2 EQU2 ]
[ .line/y PEK2 .line/y0 PEK2 EQU2 ] #0101 EQU2 ,&end JCN [ .line/y LDZ2 .line/y0 LDZ2 EQU2 ] #0101 EQU2 ,&end JCN
.line/e1 PEK2 #0002 MUL2 .line/e2 POK2 .line/e1 LDZ2 #0002 MUL2 .line/e2 STZ2
.line/e2 PEK2 .line/dy PEK2 LTS2 ,&skipy JCN .line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN
.line/e1 PEK2 .line/dy PEK2 ADD2 .line/e1 POK2 .line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
.line/x PEK2 .line/sx PEK2 ADD2 .line/x POK2 .line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2
&skipy &skipy
.line/e2 PEK2 .line/dx PEK2 GTS2 ,&skipx JCN .line/e2 LDZ2 .line/dx LDZ2 GTS2 ,&skipx JCN
.line/e1 PEK2 .line/dx PEK2 ADD2 .line/e1 POK2 .line/e1 LDZ2 .line/dx LDZ2 ADD2 .line/e1 STZ2
.line/y PEK2 .line/sy PEK2 ADD2 .line/y POK2 .line/y LDZ2 .line/sy LDZ2 ADD2 .line/y STZ2
&skipx &skipx
;&loop JMP2 ;&loop JMP2
&end &end

View File

@ -24,8 +24,8 @@
#0da4 .System/b DEO2 #0da4 .System/b DEO2
( find screen center ) ( find screen center )
.Screen/width DEI2 #0002 DIV2 .center/x POK2 .Screen/width DEI2 #0002 DIV2 .center/x STZ2
.Screen/height DEI2 #0002 DIV2 .center/y POK2 .Screen/height DEI2 #0002 DIV2 .center/y STZ2
( draw ) ( draw )
;draw-table JSR2 ;draw-table JSR2
@ -40,9 +40,9 @@ BRK
#00 #00 #00 #00
&loop &loop
( move ) OVR #0f AND #40 SFT #02 DIV #00 SWP ( move ) OVR #0f AND #40 SFT #02 DIV #00 SWP
.center/x PEK2 #0040 SUB2 ADD2 .Screen/x DEO2 .center/x LDZ2 #0040 SUB2 ADD2 .Screen/x DEO2
( move ) OVR #f0 AND #02 DIV #00 SWP ( move ) OVR #f0 AND #02 DIV #00 SWP
.center/y PEK2 #0040 SUB2 ADD2 .Screen/y DEO2 .center/y LDZ2 #0040 SUB2 ADD2 .Screen/y DEO2
( draw ) OVR .Screen/color DEO ( draw ) OVR .Screen/color DEO
( incr ) SWP #01 ADD SWP ( incr ) SWP #01 ADD SWP
DUP2 NEQ ,&loop JCN DUP2 NEQ ,&loop JCN
@ -58,14 +58,14 @@ RTN
( x-axis ) ( x-axis )
OVR #08 MUL #00 SWP OVR #08 MUL #00 SWP
.center/x PEK2 #0040 SUB2 ADD2 .Screen/x DEO2 .center/x LDZ2 #0040 SUB2 ADD2 .Screen/x DEO2
.center/y PEK2 #0050 SUB2 .Screen/y DEO2 .center/y LDZ2 #0050 SUB2 .Screen/y DEO2
( draw ) #21 .Screen/color DEO ( draw ) #21 .Screen/color DEO
( y-axis ) ( y-axis )
OVR #08 MUL #00 SWP OVR #08 MUL #00 SWP
.center/y PEK2 #0040 SUB2 ADD2 .Screen/y DEO2 .center/y LDZ2 #0040 SUB2 ADD2 .Screen/y DEO2
.center/x PEK2 #0050 SUB2 .Screen/x DEO2 .center/x LDZ2 #0050 SUB2 .Screen/x DEO2
( draw ) #21 .Screen/color DEO ( draw ) #21 .Screen/color DEO
( incr ) SWP #01 ADD SWP ( incr ) SWP #01 ADD SWP
@ -78,15 +78,15 @@ RTN
;preview_icn .Screen/addr DEO2 ;preview_icn .Screen/addr DEO2
.center/x PEK2 #0048 ADD2 .Screen/x DEO2 .center/x LDZ2 #0048 ADD2 .Screen/x DEO2
.center/y PEK2 #0030 ADD2 .Screen/y DEO2 .center/y LDZ2 #0030 ADD2 .Screen/y DEO2
#21 .Screen/color DEO #21 .Screen/color DEO
.center/x PEK2 #0050 ADD2 .Screen/x DEO2 .center/x LDZ2 #0050 ADD2 .Screen/x DEO2
#61 .Screen/color DEO #61 .Screen/color DEO
.center/x PEK2 #0048 ADD2 .Screen/x DEO2 .center/x LDZ2 #0048 ADD2 .Screen/x DEO2
.center/y PEK2 #0038 ADD2 .Screen/y DEO2 .center/y LDZ2 #0038 ADD2 .Screen/y DEO2
#a1 .Screen/color DEO #a1 .Screen/color DEO
.center/x PEK2 #0050 ADD2 .Screen/x DEO2 .center/x LDZ2 #0050 ADD2 .Screen/x DEO2
#f1 .Screen/color DEO #f1 .Screen/color DEO
RTN RTN

View File

@ -20,8 +20,8 @@
;on-frame .Screen/vector DEO2 ;on-frame .Screen/vector DEO2
( starting position ) ( starting position )
.Screen/width DEI2 #0002 DIV2 .dvd/x POK2 .Screen/width DEI2 #0002 DIV2 .dvd/x STZ2
.Screen/height DEI2 #0002 DIV2 .dvd/y POK2 .Screen/height DEI2 #0002 DIV2 .dvd/y STZ2
#21 ;draw-dvd JSR2 #21 ;draw-dvd JSR2
@ -30,16 +30,16 @@ BRK
@on-frame ( -> ) @on-frame ( -> )
( clear ) #20 ;draw-dvd JSR2 ( clear ) #20 ;draw-dvd JSR2
( case: hit-right ) .dvd/x PEK2 .Screen/width DEI2 #0020 SUB2 EQU2 ( case: hit-right ) .dvd/x LDZ2 .Screen/width DEI2 #0020 SUB2 EQU2
( case: hit-left ) .dvd/x PEK2 #0000 EQU2 ( case: hit-left ) .dvd/x LDZ2 #0000 EQU2
#0000 EQU2 ,&no-flipx JCN #0000 EQU2 ,&no-flipx JCN
.dvd/dx PEK #00 EQU .dvd/dx POK &no-flipx .dvd/dx LDZ #00 EQU .dvd/dx STZ &no-flipx
( case: hit-bottom ) .dvd/y PEK2 .Screen/height DEI2 #0010 SUB2 EQU2 ( case: hit-bottom ) .dvd/y LDZ2 .Screen/height DEI2 #0010 SUB2 EQU2
( case: hit-top ) .dvd/y PEK2 #0000 EQU2 ( case: hit-top ) .dvd/y LDZ2 #0000 EQU2
#0000 EQU2 ,&no-flipy JCN #0000 EQU2 ,&no-flipy JCN
.dvd/dy PEK #00 EQU .dvd/dy POK &no-flipy .dvd/dy LDZ #00 EQU .dvd/dy STZ &no-flipy
( incr ) .dvd/x PEK2 #0001 #00 .dvd/dx PEK #00 EQU #fffe MUL2 ADD2 ADD2 .dvd/x POK2 ( incr ) .dvd/x LDZ2 #0001 #00 .dvd/dx LDZ #00 EQU #fffe MUL2 ADD2 ADD2 .dvd/x STZ2
( incr ) .dvd/y PEK2 #0001 #00 .dvd/dy PEK #00 EQU #fffe MUL2 ADD2 ADD2 .dvd/y POK2 ( incr ) .dvd/y LDZ2 #0001 #00 .dvd/dy LDZ #00 EQU #fffe MUL2 ADD2 ADD2 .dvd/y STZ2
( draw ) #21 ;draw-dvd JSR2 ( draw ) #21 ;draw-dvd JSR2
BRK BRK
@ -48,10 +48,10 @@ BRK
( stash ) STH ( stash ) STH
;dvd_icn .Screen/addr DEO2 ;dvd_icn .Screen/addr DEO2
.dvd/y PEK2 [ .dvd/y PEK2 #0010 ADD2 ] .dvd/y LDZ2 [ .dvd/y LDZ2 #0010 ADD2 ]
&ver &ver
OVR2 .Screen/y DEO2 OVR2 .Screen/y DEO2
.dvd/x PEK2 [ .dvd/x PEK2 #0020 ADD2 ] .dvd/x LDZ2 [ .dvd/x LDZ2 #0020 ADD2 ]
&hor &hor
OVR2 .Screen/x DEO2 OVR2 .Screen/x DEO2
( draw ) DUPr STHr .Screen/color DEO ( draw ) DUPr STHr .Screen/color DEO

View File

@ -26,38 +26,38 @@
( theme ) #0f0f .System/r DEO2 #0fff .System/g DEO2 #0ff0 .System/b DEO2 ( theme ) #0f0f .System/r DEO2 #0fff .System/g DEO2 #0ff0 .System/b DEO2
( vectors ) ;on-mouse .Mouse/vector DEO2 ( vectors ) ;on-mouse .Mouse/vector DEO2
#0020 #0030 #0060 #0060 .r1/y2 POK2 .r1/x2 POK2 .r1/y1 POK2 .r1/x1 POK2 #0020 #0030 #0060 #0060 .r1/y2 STZ2 .r1/x2 STZ2 .r1/y1 STZ2 .r1/x1 STZ2
#0058 #0050 #0090 #0080 .r2/y2 POK2 .r2/x2 POK2 .r2/y1 POK2 .r2/x1 POK2 #0058 #0050 #0090 #0080 .r2/y2 STZ2 .r2/x2 STZ2 .r2/y1 STZ2 .r2/x1 STZ2
#0048 #0048 #0080 #0098 .r3/y2 POK2 .r3/x2 POK2 .r3/y1 POK2 .r3/x1 POK2 #0048 #0048 #0080 #0098 .r3/y2 STZ2 .r3/x2 STZ2 .r3/y1 STZ2 .r3/x1 STZ2
( no BRK, run through to on-mouse ) ( no BRK, run through to on-mouse )
@on-mouse @on-mouse
;pointer_icn .pointer/sprite POK2 ;pointer_icn .pointer/sprite STZ2
#01 .color POK #01 .color STZ
( matrix comparison ) ( matrix comparison )
.Mouse/x DEI2 .r1/x1 PEK2 GTH2 .Mouse/x DEI2 .r1/x2 PEK2 LTH2 #0101 EQU2 .Mouse/x DEI2 .r1/x1 LDZ2 GTH2 .Mouse/x DEI2 .r1/x2 LDZ2 LTH2 #0101 EQU2
.Mouse/y DEI2 .r1/y1 PEK2 GTH2 .Mouse/y DEI2 .r1/y2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 .r1/y1 LDZ2 GTH2 .Mouse/y DEI2 .r1/y2 LDZ2 LTH2 #0101 EQU2
#0101 NEQ2 ,&draw1 JCN #02 .color POK ;hand_icn .pointer/sprite POK2 #0101 NEQ2 ,&draw1 JCN #02 .color STZ ;hand_icn .pointer/sprite STZ2
&draw1 .r1/x1 PEK2 .r1/y1 PEK2 .r1/x2 PEK2 .r1/y2 PEK2 .color PEK ;line-rect JSR2 &draw1 .r1/x1 LDZ2 .r1/y1 LDZ2 .r1/x2 LDZ2 .r1/y2 LDZ2 .color LDZ ;line-rect JSR2
#01 .color POK #01 .color STZ
( 2-step comparison ) ( 2-step comparison )
.Mouse/x DEI2 .r2/x1 PEK2 GTH2 .Mouse/x DEI2 .r2/x2 PEK2 LTH2 #0101 NEQ2 ,&draw2 JCN .Mouse/x DEI2 .r2/x1 LDZ2 GTH2 .Mouse/x DEI2 .r2/x2 LDZ2 LTH2 #0101 NEQ2 ,&draw2 JCN
.Mouse/y DEI2 .r2/y1 PEK2 GTH2 .Mouse/y DEI2 .r2/y2 PEK2 LTH2 #0101 NEQ2 ,&draw2 JCN .Mouse/y DEI2 .r2/y1 LDZ2 GTH2 .Mouse/y DEI2 .r2/y2 LDZ2 LTH2 #0101 NEQ2 ,&draw2 JCN
#03 .color POK ;hand_icn .pointer/sprite POK2 #03 .color STZ ;hand_icn .pointer/sprite STZ2
&draw2 .r2/x1 PEK2 .r2/y1 PEK2 .r2/x2 PEK2 .r2/y2 PEK2 .color PEK ;line-rect JSR2 &draw2 .r2/x1 LDZ2 .r2/y1 LDZ2 .r2/x2 LDZ2 .r2/y2 LDZ2 .color LDZ ;line-rect JSR2
#01 .color POK #01 .color STZ
( 4-step comparison ) ( 4-step comparison )
.Mouse/x DEI2 .r3/x1 PEK2 LTH2 ,&draw3 JCN .Mouse/x DEI2 .r3/x1 LDZ2 LTH2 ,&draw3 JCN
.Mouse/x DEI2 .r3/x2 PEK2 GTH2 ,&draw3 JCN .Mouse/x DEI2 .r3/x2 LDZ2 GTH2 ,&draw3 JCN
.Mouse/y DEI2 .r3/y1 PEK2 LTH2 ,&draw3 JCN .Mouse/y DEI2 .r3/y1 LDZ2 LTH2 ,&draw3 JCN
.Mouse/y DEI2 .r3/y2 PEK2 GTH2 ,&draw3 JCN .Mouse/y DEI2 .r3/y2 LDZ2 GTH2 ,&draw3 JCN
#02 .color POK ;hand_icn .pointer/sprite POK2 #02 .color STZ ;hand_icn .pointer/sprite STZ2
&draw3 .r3/x1 PEK2 .r3/y1 PEK2 .r3/x2 PEK2 .r3/y2 PEK2 .color PEK ;line-rect JSR2 &draw3 .r3/x1 LDZ2 .r3/y1 LDZ2 .r3/x2 LDZ2 .r3/y2 LDZ2 .color LDZ ;line-rect JSR2
;draw-cursor JSR2 ;draw-cursor JSR2
@ -67,35 +67,35 @@ BRK
( clear last cursor ) ( clear last cursor )
;clear_icn .Screen/addr DEO2 ;clear_icn .Screen/addr DEO2
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record pointer positions ) ( record pointer positions )
.Mouse/x DEI2 .pointer/x POK2 .Mouse/y DEI2 .pointer/y POK2 .Mouse/x DEI2 .pointer/x STZ2 .Mouse/y DEI2 .pointer/y STZ2
( draw new cursor ) ( draw new cursor )
.pointer/sprite PEK2 .Screen/addr DEO2 .pointer/sprite LDZ2 .Screen/addr DEO2
.pointer/x PEK2 .Screen/x DEO2 .pointer/x LDZ2 .Screen/x DEO2
.pointer/y PEK2 .Screen/y DEO2 .pointer/y LDZ2 .Screen/y DEO2
#31 .Screen/color DEO #31 .Screen/color DEO
RTN RTN
@line-rect ( x1* y1* x2* y2* color -- ) @line-rect ( x1* y1* x2* y2* color -- )
( load ) .color POK .rect/y2 POK2 .rect/x2 POK2 DUP2 .Screen/y DEO2 .rect/y1 POK2 DUP2 .Screen/x DEO2 .rect/x1 POK2 ( load ) .color STZ .rect/y2 STZ2 .rect/x2 STZ2 DUP2 .Screen/y DEO2 .rect/y1 STZ2 DUP2 .Screen/x DEO2 .rect/x1 STZ2
&hor &hor
( incr ) .Screen/x DEI2 #0001 ADD2 .Screen/x DEO2 ( incr ) .Screen/x DEI2 #0001 ADD2 .Screen/x DEO2
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO ( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO ( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .color LDZ .Screen/color DEO
.Screen/x DEI2 .rect/x2 PEK2 LTH2 ,&hor JCN .Screen/x DEI2 .rect/x2 LDZ2 LTH2 ,&hor JCN
.rect/y1 PEK2 .Screen/y DEO2 .rect/y1 LDZ2 .Screen/y DEO2
&ver &ver
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK .Screen/color DEO ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .color PEK .Screen/color DEO ( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .color LDZ .Screen/color DEO
( incr ) .Screen/y DEI2 #0001 ADD2 .Screen/y DEO2 ( incr ) .Screen/y DEI2 #0001 ADD2 .Screen/y DEO2
.Screen/y DEI2 .rect/y2 PEK2 #0001 ADD2 LTH2 ,&ver JCN .Screen/y DEI2 .rect/y2 LDZ2 #0001 ADD2 LTH2 ,&ver JCN
RTN RTN

View File

@ -27,30 +27,30 @@ BRK
@draw ( -- ) @draw ( -- )
( find screen center ) ( find screen center )
.Screen/width DEI2 #0002 DIV2 .center/x POK2 .Screen/width DEI2 #0002 DIV2 .center/x STZ2
.Screen/height DEI2 #0002 DIV2 .center/y POK2 .Screen/height DEI2 #0002 DIV2 .center/y STZ2
( draw ver line ) ( draw ver line )
.center/x PEK2 .Screen/x DEO2 #0000 .Screen/y DEO2 .center/x LDZ2 .Screen/x DEO2 #0000 .Screen/y DEO2
&draw-ver &draw-ver
( draw ) #02 .Screen/color DEO ( draw ) #02 .Screen/color DEO
( incr ) .Screen/y DEI2 #0002 ADD2 .Screen/y DEO2 ( incr ) .Screen/y DEI2 #0002 ADD2 .Screen/y DEO2
.Screen/y DEI2 .Screen/height DEI2 LTH2 ,&draw-ver JCN .Screen/y DEI2 .Screen/height DEI2 LTH2 ,&draw-ver JCN
.center/x PEK2 .center/y PEK2 #0010 SUB2 #2c ;text1 ;draw-label-left JSR2 .center/x LDZ2 .center/y LDZ2 #0010 SUB2 #2c ;text1 ;draw-label-left JSR2
.center/x PEK2 .center/y PEK2 #2c ;text2 ;draw-label-middle JSR2 .center/x LDZ2 .center/y LDZ2 #2c ;text2 ;draw-label-middle JSR2
.center/x PEK2 .center/y PEK2 #0010 ADD2 #2c ;text3 ;draw-label-right JSR2 .center/x LDZ2 .center/y LDZ2 #0010 ADD2 #2c ;text3 ;draw-label-right JSR2
.center/x PEK2 .center/y PEK2 #0020 ADD2 #2c ;text4 ;draw-label-middle JSR2 .center/x LDZ2 .center/y LDZ2 #0020 ADD2 #2c ;text4 ;draw-label-middle JSR2
.center/x PEK2 .center/y PEK2 #0030 ADD2 #2c ;text5 ;draw-label-middle JSR2 .center/x LDZ2 .center/y LDZ2 #0030 ADD2 #2c ;text5 ;draw-label-middle JSR2
RTN RTN
@draw-label-left ( x y color addr -- ) @draw-label-left ( x y color addr -- )
( load ) .label/addr POK2 .label/color POK .Screen/y DEO2 .Screen/x DEO2 ( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2 .Screen/x DEO2
.label/addr PEK2 .label/addr LDZ2
&loop &loop
( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO ( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/color DEO
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
DUP2 LDA #00 NEQ ,&loop JCN DUP2 LDA #00 NEQ ,&loop JCN
@ -60,11 +60,11 @@ RTN
@draw-label-middle ( x y color addr -- ) @draw-label-middle ( x y color addr -- )
( load ) .label/addr POK2 .label/color POK .Screen/y DEO2 ( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2
( align ) .label/addr PEK2 ;get-text-length JSR2 #0008 MUL2 #0002 DIV2 SUB2 .Screen/x DEO2 ( align ) .label/addr LDZ2 ;get-text-length JSR2 #0008 MUL2 #0002 DIV2 SUB2 .Screen/x DEO2
.label/addr PEK2 .label/addr LDZ2
&loop &loop
( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO ( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/color DEO
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
DUP2 LDA #00 NEQ ,&loop JCN DUP2 LDA #00 NEQ ,&loop JCN
@ -74,11 +74,11 @@ RTN
@draw-label-right ( x y color addr -- ) @draw-label-right ( x y color addr -- )
( load ) .label/addr POK2 .label/color POK .Screen/y DEO2 ( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2
( align ) .label/addr PEK2 ;get-text-length JSR2 #0008 MUL2 SUB2 #0008 SUB2 .Screen/x DEO2 ( align ) .label/addr LDZ2 ;get-text-length JSR2 #0008 MUL2 SUB2 #0008 SUB2 .Screen/x DEO2
.label/addr PEK2 .label/addr LDZ2
&loop &loop
( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO ( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/color DEO
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
DUP2 LDA #00 NEQ ,&loop JCN DUP2 LDA #00 NEQ ,&loop JCN

View File

@ -42,14 +42,14 @@ BRK
@draw-icn ( x y width height color addr -- ) @draw-icn ( x y width height color addr -- )
( load ) .Screen/addr DEO2 .color POK .size/height POK2 .size/width POK2 .position/y POK2 .position/x POK2 ( load ) .Screen/addr DEO2 .color STZ .size/height STZ2 .size/width STZ2 .position/y STZ2 .position/x STZ2
#0000 .size/height PEK2 #0000 .size/height LDZ2
&ver &ver
( save ) OVR2 .position/y PEK2 ADD2 .Screen/y DEO2 ( save ) OVR2 .position/y LDZ2 ADD2 .Screen/y DEO2
#0000 .size/width PEK2 #0000 .size/width LDZ2
&hor &hor
( save ) OVR2 .position/x PEK2 ADD2 .Screen/x DEO2 ( save ) OVR2 .position/x LDZ2 ADD2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2 ( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2
( incr ) SWP2 8+ SWP2 ( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&hor JCN OVR2 OVR2 LTH2 ,&hor JCN
@ -62,14 +62,14 @@ RTN
@draw-chr ( x y width height color addr -- ) @draw-chr ( x y width height color addr -- )
( load ) .Screen/addr DEO2 .color POK .size/height POK2 .size/width POK2 .position/y POK2 .position/x POK2 ( load ) .Screen/addr DEO2 .color STZ .size/height STZ2 .size/width STZ2 .position/y STZ2 .position/x STZ2
#0000 .size/height PEK2 #0000 .size/height LDZ2
&ver &ver
( save ) OVR2 .position/y PEK2 ADD2 .Screen/y DEO2 ( save ) OVR2 .position/y LDZ2 ADD2 .Screen/y DEO2
#0000 .size/width PEK2 #0000 .size/width LDZ2
&hor &hor
( save ) OVR2 .position/x PEK2 ADD2 .Screen/x DEO2 ( save ) OVR2 .position/x LDZ2 ADD2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
( incr ) .Screen/addr DEI2 #0010 ADD2 .Screen/addr DEO2 ( incr ) .Screen/addr DEI2 #0010 ADD2 .Screen/addr DEO2
( incr ) SWP2 8+ SWP2 ( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&hor JCN OVR2 OVR2 LTH2 ,&hor JCN
@ -82,14 +82,14 @@ RTN
@cover-pattern ( addr color -- ) @cover-pattern ( addr color -- )
( load ) .color POK .Screen/addr DEO2 ( load ) .color STZ .Screen/addr DEO2
#0000 .Screen/height DEI2 #0000 .Screen/height DEI2
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
#0000 .Screen/width DEI2 #0000 .Screen/width DEI2
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
( incr ) SWP2 8+ SWP2 ( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&hor JCN OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2 POP2 POP2

View File

@ -46,23 +46,23 @@ BRK
@line-slow ( x1 y1 x2 y2 color -- ) @line-slow ( x1 y1 x2 y2 color -- )
( load ) .color POK -- .line/y0 POK2 -- .line/x0 POK2 .line/y POK2 .line/x POK2 ( load ) .color STZ -- .line/y0 STZ2 -- .line/x0 STZ2 .line/y STZ2 .line/x STZ2
.line/x0 PEK2 .line/x PEK2 SUB2 ABS2 .line/dx POK2 .line/x0 LDZ2 .line/x LDZ2 SUB2 ABS2 .line/dx STZ2
.line/y0 PEK2 .line/y PEK2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy POK2 .line/y0 LDZ2 .line/y LDZ2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy STZ2
#ffff #00 .line/x PEK2 .line/x0 PEK2 LTS2 #0002 MUL2 ADD2 .line/sx POK2 #ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sx STZ2
#ffff #00 .line/y PEK2 .line/y0 PEK2 LTS2 #0002 MUL2 ADD2 .line/sy POK2 #ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sy STZ2
.line/dx PEK2 .line/dy PEK2 ADD2 .line/e1 POK2 .line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
&loop &loop
.line/x PEK2 .Screen/x DEO2 .line/y PEK2 .Screen/y DEO2 .color PEK .Screen/color DEO .line/x LDZ2 .Screen/x DEO2 .line/y LDZ2 .Screen/y DEO2 .color LDZ .Screen/color DEO
.line/x PEK2 .line/x0 PEK2 EQU2 .line/y PEK2 .line/y0 PEK2 EQU2 #0101 EQU2 ,&end JCN .line/x LDZ2 .line/x0 LDZ2 EQU2 .line/y LDZ2 .line/y0 LDZ2 EQU2 #0101 EQU2 ,&end JCN
.line/e1 PEK2 #0002 MUL2 .line/e2 POK2 .line/e1 LDZ2 #0002 MUL2 .line/e2 STZ2
.line/e2 PEK2 .line/dy PEK2 LTS2 ,&skipy JCN .line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN
.line/e1 PEK2 .line/dy PEK2 ADD2 .line/e1 POK2 .line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
.line/x PEK2 .line/sx PEK2 ADD2 .line/x POK2 .line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2
&skipy &skipy
.line/e2 PEK2 .line/dx PEK2 GTS2 ,&skipx JCN .line/e2 LDZ2 .line/dx LDZ2 GTS2 ,&skipx JCN
.line/e1 PEK2 .line/dx PEK2 ADD2 .line/e1 POK2 .line/e1 LDZ2 .line/dx LDZ2 ADD2 .line/e1 STZ2
.line/y PEK2 .line/sy PEK2 ADD2 .line/y POK2 .line/y LDZ2 .line/sy LDZ2 ADD2 .line/y STZ2
&skipx &skipx
;&loop JMP2 ;&loop JMP2
@ -72,20 +72,20 @@ RTN
@line-rect ( x1 y1 x2 y2 color -- ) @line-rect ( x1 y1 x2 y2 color -- )
( load ) .color POK DUP2 STH2 -- .rect/y2 POK2 -- .rect/x2 POK2 DUP2 STH2 .rect/y1 POK2 .rect/x1 POK2 ( load ) .color STZ DUP2 STH2 -- .rect/y2 STZ2 -- .rect/x2 STZ2 DUP2 STH2 .rect/y1 STZ2 .rect/x1 STZ2
STH2r STH2r STH2r STH2r
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK DUP .Screen/color DEO ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .Screen/color DEO ( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/color DEO
( incr ) SWP2 ++ SWP2 ( incr ) SWP2 ++ SWP2
OVR2 OVR2 LTS2 ,&ver JCN OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2 POP2 POP2
.rect/x1 PEK2 .rect/x2 PEK2 .rect/x1 LDZ2 .rect/x2 LDZ2
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK DUP .Screen/color DEO ( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .Screen/color DEO ( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/color DEO
( incr ) SWP2 ++ SWP2 ( incr ) SWP2 ++ SWP2
OVR2 OVR2 ++ LTS2 ,&hor JCN OVR2 OVR2 ++ LTS2 ,&hor JCN
POP2 POP2 POP2 POP2
@ -94,14 +94,14 @@ RTN
@fill-rect ( x1 y1 x2 y2 color -- ) @fill-rect ( x1 y1 x2 y2 color -- )
.color POK .color STZ
( x1 x2 y1 y2 ) ROT2 SWP2 ( x1 x2 y1 y2 ) ROT2 SWP2
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
STH2 STH2 OVR2 OVR2 STH2 STH2 OVR2 OVR2
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
( incr ) SWP2 ++ SWP2 ( incr ) SWP2 ++ SWP2
OVR2 OVR2 LTS2 ,&hor JCN OVR2 OVR2 LTS2 ,&hor JCN
POP2 POP2 STH2r STH2r POP2 POP2 STH2r STH2r
@ -113,44 +113,44 @@ RTN
@draw-circle ( xc yc r color -- ) @draw-circle ( xc yc r color -- )
( load ) .color POK .circle/r POK2 .circle/yc POK2 .circle/xc POK2 ( load ) .color STZ .circle/r STZ2 .circle/yc STZ2 .circle/xc STZ2
#0000 .circle/x POK2 .circle/r PEK2 .circle/y POK2 #0000 .circle/x STZ2 .circle/r LDZ2 .circle/y STZ2
.circle/r PEK2 #0002 MUL2 .circle/d POK2 .circle/r LDZ2 #0002 MUL2 .circle/d STZ2
( draw ) ;&seg JSR2 ( draw ) ;&seg JSR2
&loop &loop
( incr ) .circle/x PEK2 ++ .circle/x POK2 ( incr ) .circle/x LDZ2 ++ .circle/x STZ2
.circle/d PEK2 #0001 LTS2 ,&else JCN .circle/d LDZ2 #0001 LTS2 ,&else JCN
( decr ) .circle/y PEK2 -- .circle/y POK2 ( decr ) .circle/y LDZ2 -- .circle/y STZ2
.circle/x PEK2 .circle/y PEK2 SUB2 #0004 MUL2 .circle/d PEK2 ADD2 .circle/d POK2 .circle/x LDZ2 .circle/y LDZ2 SUB2 #0004 MUL2 .circle/d LDZ2 ADD2 .circle/d STZ2
;&end JMP2 ;&end JMP2
&else &else
.circle/x PEK2 #0004 MUL2 .circle/d PEK2 ADD2 .circle/d POK2 .circle/x LDZ2 #0004 MUL2 .circle/d LDZ2 ADD2 .circle/d STZ2
&end &end
( draw ) ;&seg JSR2 ( draw ) ;&seg JSR2
.circle/y PEK2 .circle/x PEK2 -- GTS2 ,&loop JCN .circle/y LDZ2 .circle/x LDZ2 -- GTS2 ,&loop JCN
RTN RTN
&seg &seg
.circle/xc PEK2 .circle/x PEK2 ADD2 .Screen/x DEO2 .circle/yc PEK2 .circle/y PEK2 ADD2 .Screen/y DEO2 .color PEK .Screen/color DEO .circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/color DEO
.circle/xc PEK2 .circle/x PEK2 SUB2 .Screen/x DEO2 .circle/yc PEK2 .circle/y PEK2 ADD2 .Screen/y DEO2 .color PEK .Screen/color DEO .circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/color DEO
.circle/xc PEK2 .circle/x PEK2 ADD2 .Screen/x DEO2 .circle/yc PEK2 .circle/y PEK2 SUB2 .Screen/y DEO2 .color PEK .Screen/color DEO .circle/xc LDZ2 .circle/x LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/color DEO
.circle/xc PEK2 .circle/x PEK2 SUB2 .Screen/x DEO2 .circle/yc PEK2 .circle/y PEK2 SUB2 .Screen/y DEO2 .color PEK .Screen/color DEO .circle/xc LDZ2 .circle/x LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/y LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/color DEO
.circle/xc PEK2 .circle/y PEK2 ADD2 .Screen/x DEO2 .circle/yc PEK2 .circle/x PEK2 ADD2 .Screen/y DEO2 .color PEK .Screen/color DEO .circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/color DEO
.circle/xc PEK2 .circle/y PEK2 SUB2 .Screen/x DEO2 .circle/yc PEK2 .circle/x PEK2 ADD2 .Screen/y DEO2 .color PEK .Screen/color DEO .circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 ADD2 .Screen/y DEO2 .color LDZ .Screen/color DEO
.circle/xc PEK2 .circle/y PEK2 ADD2 .Screen/x DEO2 .circle/yc PEK2 .circle/x PEK2 SUB2 .Screen/y DEO2 .color PEK .Screen/color DEO .circle/xc LDZ2 .circle/y LDZ2 ADD2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/color DEO
.circle/xc PEK2 .circle/y PEK2 SUB2 .Screen/x DEO2 .circle/yc PEK2 .circle/x PEK2 SUB2 .Screen/y DEO2 .color PEK .Screen/color DEO .circle/xc LDZ2 .circle/y LDZ2 SUB2 .Screen/x DEO2 .circle/yc LDZ2 .circle/x LDZ2 SUB2 .Screen/y DEO2 .color LDZ .Screen/color DEO
RTN RTN
@cover-pattern ( addr color -- ) @cover-pattern ( addr color -- )
( load ) .color POK .Screen/addr DEO2 ( load ) .color STZ .Screen/addr DEO2
#0000 .Screen/height DEI2 #0000 .Screen/height DEI2
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
#0000 .Screen/width DEI2 #0000 .Screen/width DEI2
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
( incr ) SWP2 8+ SWP2 ( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ,&hor JCN OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2 POP2 POP2

View File

@ -11,10 +11,10 @@
|0100 ( -> ) |0100 ( -> )
#90ff .System/r DEO2 #9000 .System/g DEO2 #900f .System/b DEO2 #90ff .System/r DEO2 #9000 .System/g DEO2 #900f .System/b DEO2
#08e0 .Screen/width DEI2 #0001 SFT2 SUB2 .scroll/x POK2 #08e0 .Screen/width DEI2 #0001 SFT2 SUB2 .scroll/x STZ2
#09b0 .scroll/y POK2 #09b0 .scroll/y STZ2
;frame .Screen/vector DEO2 ;frame .Screen/vector DEO2
#30 .scroll/wait POK #30 .scroll/wait STZ
BRK BRK
@frame ( -> ) @frame ( -> )
@ -24,22 +24,22 @@
#0001 ADD2 #0001 ADD2
DUP2 .Screen/height DEI2 LTH2 ,&loop JCN DUP2 .Screen/height DEI2 LTH2 ,&loop JCN
POP2 POP2
.scroll/wait PEK ,&noscroll JCN .scroll/wait LDZ ,&noscroll JCN
.scroll/y PEK2 #0001 ADD2 .scroll/y POK2 .scroll/y LDZ2 #0001 ADD2 .scroll/y STZ2
BRK BRK
&noscroll &noscroll
.scroll/wait PEK #01 SUB .scroll/wait POK .scroll/wait LDZ #01 SUB .scroll/wait STZ
BRK BRK
@row ( y* -- ) @row ( y* -- )
DUP2 .Screen/y DEO2 DUP2 .Screen/y DEO2
.scroll/y PEK2 ADD2 .scroll/y LDZ2 ADD2
.Screen/width DEI2 .Screen/width DEI2
&loop &loop
#0001 SUB2 #0001 SUB2
OVR2 OVR2 .scroll/x PEK2 ADD2 EOR2 DUP2 #0013 DIV2 #0013 MUL2 SUB2 OVR2 OVR2 .scroll/x LDZ2 ADD2 EOR2 DUP2 #0013 DIV2 #0013 MUL2 SUB2
DUP #00 EQU ,&draw JCN DUP #00 EQU ,&draw JCN
DUP #05 EQU ,&draw JCN DUP #05 EQU ,&draw JCN
POP2 POP2

View File

@ -426,7 +426,7 @@
;asma-parse-hex-string JSR2 ;asma-parse-hex-string JSR2
,&valid JCN ,&valid JCN
;asma-msg-hex ;asma/error POK2 ;asma-msg-hex ;asma/error STZ2
JMP2r JMP2r
&valid &valid
@ -732,8 +732,8 @@
&JCN $2 $2 "JCN 00 &JCN $2 $2 "JCN 00
&JSR :&JMP :&LDR "JSR 00 &JSR :&JMP :&LDR "JSR 00
&STH :&SFT :&SUB "STH 00 &STH :&SFT :&SUB "STH 00
&PEK :&OVR :&POK "PEK 00 &LDZ :&OVR :&STZ "LDZ 00
&POK $2 $2 "POK 00 &STZ $2 $2 "STZ 00
&LDR :&LDA :&LIT "LDR 00 &LDR :&LDA :&LIT "LDR 00
&STR $2 $2 "STR 00 &STR $2 $2 "STR 00
&LDA $2 $2 "LDA 00 &LDA $2 $2 "LDA 00
@ -745,7 +745,7 @@
&MUL $2 $2 "MUL 00 &MUL $2 $2 "MUL 00
&DIV $2 $2 "DIV 00 &DIV $2 $2 "DIV 00
&AND :&ADD $2 "AND 00 &AND :&ADD $2 "AND 00
&ORA :&NEQ :&PEK "ORA 00 &ORA :&NEQ :&LDZ "ORA 00
&EOR $2 $2 "EOR 00 &EOR $2 $2 "EOR 00
&SFT :&ROT :&STA "SFT 00 &SFT :&ROT :&STA "SFT 00

View File

@ -66,7 +66,7 @@
;filepath ;load-file JSR2 ;filepath ;load-file JSR2
( place textarea ) ( place textarea )
#0018 .textarea/x1 POK2 .Screen/height DEI2 8- .textarea/y2 POK2 #0018 .textarea/x1 STZ2 .Screen/height DEI2 8- .textarea/y2 STZ2
;select JSR2 ;select JSR2
;redraw JSR2 ;redraw JSR2
@ -79,13 +79,13 @@ BRK
.Controller/button DEI #0f AND #02 NEQ ,&no-alt JCN .Controller/button DEI #0f AND #02 NEQ ,&no-alt JCN
.Controller/button DEI #04 SFT .Controller/button DEI #04 SFT
DUP #01 NEQ ,&no-aup JCN DUP #01 NEQ ,&no-aup JCN
( sel word ) ;find-wordstart JSR2 .selection/to POK2 &no-aup ( sel word ) ;find-wordstart JSR2 .selection/to STZ2 &no-aup
DUP #02 NEQ ,&no-adown JCN DUP #02 NEQ ,&no-adown JCN
( sel word ) ;find-wordend JSR2 .selection/to POK2 &no-adown ( sel word ) ;find-wordend JSR2 .selection/to STZ2 &no-adown
DUP #04 NEQ ,&no-aleft JCN DUP #04 NEQ ,&no-aleft JCN
( sel decr ) .selection/to PEK2 -- .selection/to POK2 &no-aleft ( sel decr ) .selection/to LDZ2 -- .selection/to STZ2 &no-aleft
DUP #08 NEQ ,&no-aright JCN DUP #08 NEQ ,&no-aright JCN
( sel incr ) .selection/to PEK2 ++ .selection/to POK2 &no-aright ( sel incr ) .selection/to LDZ2 ++ .selection/to STZ2 &no-aright
POP POP
;clamp-selection JSR2 ;clamp-selection JSR2
;redraw JSR2 ;redraw JSR2
@ -112,20 +112,20 @@ BRK
.Controller/button DEI #f0 AND #00 EQU ;&no-arrow JCN2 .Controller/button DEI #f0 AND #00 EQU ;&no-arrow JCN2
.Controller/button DEI #f0 AND .Controller/button DEI #f0 AND
DUP #10 NEQ ,&no-arrowup JCN DUP #10 NEQ ,&no-arrowup JCN
( clamp ) .position/y PEK2 #0000 EQU2 ,&no-arrowup JCN ( clamp ) .position/y LDZ2 #0000 EQU2 ,&no-arrowup JCN
;find-lineoffset JSR2 .position/x POK2 .position/y PEK2 -- .position/y POK2 ;find-lineoffset JSR2 .position/x STZ2 .position/y LDZ2 -- .position/y STZ2
;find-selection JSR2 DUP2 .selection/from POK2 ++ .selection/to POK2 &no-arrowup ;find-selection JSR2 DUP2 .selection/from STZ2 ++ .selection/to STZ2 &no-arrowup
DUP #20 NEQ ,&no-arrowdown JCN DUP #20 NEQ ,&no-arrowdown JCN
( clamp:TODO ) ( clamp:TODO )
;find-lineoffset JSR2 .position/x POK2 .position/y PEK2 ++ .position/y POK2 ;find-lineoffset JSR2 .position/x STZ2 .position/y LDZ2 ++ .position/y STZ2
;find-selection JSR2 DUP2 .selection/from POK2 ++ .selection/to POK2 &no-arrowdown ;find-selection JSR2 DUP2 .selection/from STZ2 ++ .selection/to STZ2 &no-arrowdown
DUP #40 NEQ ,&no-arrowleft JCN DUP #40 NEQ ,&no-arrowleft JCN
( clamp ) .selection/from PEK2 ;document/body EQU2 ,&no-arrowleft JCN ( clamp ) .selection/from LDZ2 ;document/body EQU2 ,&no-arrowleft JCN
.selection/from PEK2 -- DUP2 .selection/from POK2 ++ .selection/to POK2 &no-arrowleft .selection/from LDZ2 -- DUP2 .selection/from STZ2 ++ .selection/to STZ2 &no-arrowleft
DUP #80 NEQ ,&no-arrowright JCN DUP #80 NEQ ,&no-arrowright JCN
( clamp:TODO ) ( clamp:TODO )
#aa .Console/byte DEO #aa .Console/byte DEO
.selection/from PEK2 ++ DUP2 .selection/from POK2 ++ .selection/to POK2 &no-arrowright .selection/from LDZ2 ++ DUP2 .selection/from STZ2 ++ .selection/to STZ2 &no-arrowright
POP POP
;clamp-selection JSR2 ;clamp-selection JSR2
;follow-selection JSR2 ;follow-selection JSR2
@ -134,24 +134,24 @@ BRK
.Controller/key DEI #08 NEQ ,&no-backspace JCN .Controller/key DEI #08 NEQ ,&no-backspace JCN
( erase ) ( erase )
.selection/to PEK2 .selection/from PEK2 SUB2 #0001 NEQ2 ,&erase-multiple JCN .selection/to LDZ2 .selection/from LDZ2 SUB2 #0001 NEQ2 ,&erase-multiple JCN
.selection/to PEK2 .selection/from PEK2 SUB2 ;shift-left JSR2 .selection/to LDZ2 .selection/from LDZ2 SUB2 ;shift-left JSR2
;&erase-end JMP2 ;&erase-end JMP2
&erase-multiple &erase-multiple
.selection/from PEK2 ++ .selection/from POK2 .selection/from LDZ2 ++ .selection/from STZ2
.selection/to PEK2 .selection/from PEK2 SUB2 ++ ;shift-left JSR2 .selection/to LDZ2 .selection/from LDZ2 SUB2 ++ ;shift-left JSR2
&erase-end &erase-end
.selection/from PEK2 -- .selection/from POK2 .selection/from LDZ2 -- .selection/from STZ2
.selection/from PEK2 ++ .selection/to POK2 .selection/from LDZ2 ++ .selection/to STZ2
;redraw JSR2 ;redraw JSR2
BRK BRK
&no-backspace &no-backspace
( insert ) ( insert )
.selection/to PEK2 .selection/from PEK2 SUB2 ;shift-right JSR2 .selection/to LDZ2 .selection/from LDZ2 SUB2 ;shift-right JSR2
.Controller/key DEI .selection/from PEK2 STA .Controller/key DEI .selection/from LDZ2 STA
.selection/from PEK2 ++ .selection/from POK2 .selection/from LDZ2 ++ .selection/from STZ2
.selection/from PEK2 ++ .selection/to POK2 .selection/from LDZ2 ++ .selection/to STZ2
;redraw JSR2 ;redraw JSR2
BRK BRK
@ -164,7 +164,7 @@ BRK
;touch-scrollbar JMP2 ;touch-scrollbar JMP2
&touch-end &touch-end
.Mouse/state DEI .touch/state POK .Mouse/state DEI .touch/state STZ
;draw-cursor JSR2 ;draw-cursor JSR2
@ -172,9 +172,9 @@ BRK
@touch-linebar ( -- ) @touch-linebar ( -- )
#0000 .position/x POK2 #0000 .position/x STZ2
.Mouse/y DEI2 8/ .scroll/y PEK2 ADD2 .position/y POK2 .Mouse/y DEI2 8/ .scroll/y LDZ2 ADD2 .position/y STZ2
;find-selection JSR2 DUP2 .selection/from POK2 ++ .selection/to POK2 ;find-selection JSR2 DUP2 .selection/from STZ2 ++ .selection/to STZ2
;goto-linestart JSR2 ;goto-linestart JSR2
;redraw JSR2 ;redraw JSR2
;draw-cursor JSR2 ;draw-cursor JSR2
@ -183,8 +183,8 @@ BRK
@touch-body ( -- ) @touch-body ( -- )
.Mouse/y DEI2 8/ .scroll/y PEK2 ADD2 .position/y POK2 .Mouse/y DEI2 8/ .scroll/y LDZ2 ADD2 .position/y STZ2
.Mouse/x DEI2 .textarea/x1 PEK2 SUB2 #0007 ADD2 #0007 DIV2 .position/x POK2 .Mouse/x DEI2 .textarea/x1 LDZ2 SUB2 #0007 ADD2 #0007 DIV2 .position/x STZ2
( chords ) ( chords )
.Mouse/chord DEI #00 EQU ,&no-chords JCN .Mouse/chord DEI #00 EQU ,&no-chords JCN
.Mouse/chord DEI .Mouse/chord DEI
@ -197,16 +197,16 @@ BRK
BRK BRK
&no-chords &no-chords
( drag ) ( drag )
.Mouse/state DEI .touch/state PEK NEQ .Controller/button DEI #0f AND #02 NEQ #0101 EQU2 ,&no-drag JCN .Mouse/state DEI .touch/state LDZ NEQ .Controller/button DEI #0f AND #02 NEQ #0101 EQU2 ,&no-drag JCN
( on drag ) ( on drag )
;find-selection JSR2 ++ .selection/to POK2 ;find-selection JSR2 ++ .selection/to STZ2
;clamp-selection JSR2 ;clamp-selection JSR2
,&end JMP ,&end JMP
&no-drag &no-drag
( on click ) ( on click )
;find-selection JSR2 DUP2 .selection/from POK2 ++ .selection/to POK2 ;find-selection JSR2 DUP2 .selection/from STZ2 ++ .selection/to STZ2
&end &end
.Mouse/state DEI .touch/state POK .Mouse/state DEI .touch/state STZ
;draw-cursor JSR2 ;draw-cursor JSR2
;redraw JSR2 ;redraw JSR2
@ -215,16 +215,16 @@ BRK
@touch-scrollbar ( -- ) @touch-scrollbar ( -- )
.Mouse/y DEI2 #0008 GTH2 ,&no-up JCN .Mouse/y DEI2 #0008 GTH2 ,&no-up JCN
( decr ) .scroll/y PEK2 #00 .scroll/y PEK2 #0000 NEQ2 SUB2 .scroll/y POK2 ( decr ) .scroll/y LDZ2 #00 .scroll/y LDZ2 #0000 NEQ2 SUB2 .scroll/y STZ2
,&end JMP ,&end JMP
&no-up &no-up
.Mouse/y DEI2 .Screen/height DEI2 8- LTH2 ,&no-down JCN .Mouse/y DEI2 .Screen/height DEI2 8- LTH2 ,&no-down JCN
( incr ) .scroll/y PEK2 ++ .scroll/y POK2 ( incr ) .scroll/y LDZ2 ++ .scroll/y STZ2
,&end JMP ,&end JMP
&no-down &no-down
.Mouse/y DEI2 8- .scroll/y POK2 .Mouse/y DEI2 8- .scroll/y STZ2
&end &end
.Mouse/state DEI .touch/state POK .Mouse/state DEI .touch/state STZ
;draw-cursor JSR2 ;draw-cursor JSR2
;redraw JSR2 ;redraw JSR2
@ -243,205 +243,205 @@ RTN
@scroll-up ( length -- ) @scroll-up ( length -- )
DUP2 .scroll/y PEK2 LTH2 ,&clamp JCN DUP2 .scroll/y LDZ2 LTH2 ,&clamp JCN
#0000 .scroll/y POK2 POP2 RTN #0000 .scroll/y STZ2 POP2 RTN
&clamp &clamp
.scroll/y PEK2 SWP2 SUB2 .scroll/y POK2 .scroll/y LDZ2 SWP2 SUB2 .scroll/y STZ2
RTN RTN
@scroll-down ( length -- ) @scroll-down ( length -- )
( TODO: Clamp ) ( TODO: Clamp )
.scroll/y PEK2 SWP2 ADD2 .scroll/y POK2 .scroll/y LDZ2 SWP2 ADD2 .scroll/y STZ2
RTN RTN
@shift-left ( length -- ) @shift-left ( length -- )
.i POK2 .i STZ2
.selection/from PEK2 -- .j POK2 ( start -> end ) .selection/from LDZ2 -- .j STZ2 ( start -> end )
&loop &loop
( move ) .j PEK2 .i PEK2 ADD2 LDA .j PEK2 STA ( move ) .j LDZ2 .i LDZ2 ADD2 LDA .j LDZ2 STA
( incr ) .j PEK2 ++ .j POK2 ( incr ) .j LDZ2 ++ .j STZ2
.j PEK2 ;document/eof LDA2 LTH2 ,&loop JCN .j LDZ2 ;document/eof LDA2 LTH2 ,&loop JCN
;document/eof LDA2 .i PEK2 SUB2 ;document/eof STA2 ;document/eof LDA2 .i LDZ2 SUB2 ;document/eof STA2
RTN RTN
@shift-right ( length -- ) @shift-right ( length -- )
.i POK2 .i STZ2
;document/eof LDA2 .j POK2 ( end -> start ) ;document/eof LDA2 .j STZ2 ( end -> start )
&loop &loop
( move ) .j PEK2 .i PEK2 SUB2 LDA .j PEK2 STA ( move ) .j LDZ2 .i LDZ2 SUB2 LDA .j LDZ2 STA
( decr ) .j PEK2 -- .j POK2 ( decr ) .j LDZ2 -- .j STZ2
.j PEK2 .selection/from PEK2 GTH2 ,&loop JCN .j LDZ2 .selection/from LDZ2 GTH2 ,&loop JCN
;document/eof LDA2 .i PEK2 ADD2 ;document/eof STA2 ;document/eof LDA2 .i LDZ2 ADD2 ;document/eof STA2
RTN RTN
@follow-selection ( -- ) @follow-selection ( -- )
.position/y PEK2 .scroll/y PEK2 GTH2 ,&no-up JCN .position/y LDZ2 .scroll/y LDZ2 GTH2 ,&no-up JCN
.position/y PEK2 .scroll/y POK2 RTN .position/y LDZ2 .scroll/y STZ2 RTN
&no-up &no-up
.position/y PEK2 .Screen/height DEI2 #0010 SUB2 8/ .scroll/y PEK2 ADD2 LTH2 ,&no-down JCN .position/y LDZ2 .Screen/height DEI2 #0010 SUB2 8/ .scroll/y LDZ2 ADD2 LTH2 ,&no-down JCN
.position/y PEK2 .Screen/height DEI2 #0010 SUB2 8/ SUB2 .scroll/y POK2 RTN .position/y LDZ2 .Screen/height DEI2 #0010 SUB2 8/ SUB2 .scroll/y STZ2 RTN
&no-down &no-down
RTN RTN
@clamp-selection ( -- ) @clamp-selection ( -- )
.selection/from PEK2 .selection/to PEK2 LTH2 RTN? .selection/from LDZ2 .selection/to LDZ2 LTH2 RTN?
.selection/from PEK2 ++ .selection/to POK2 .selection/from LDZ2 ++ .selection/to STZ2
RTN RTN
@goto-linestart ( -- ) @goto-linestart ( -- )
&loop &loop
.selection/from PEK2 -- LDA #0a EQU RTN? .selection/from LDZ2 -- LDA #0a EQU RTN?
.selection/from PEK2 -- LDA #0d EQU RTN? .selection/from LDZ2 -- LDA #0d EQU RTN?
( decr ) .selection/from PEK2 DUP2 .selection/to POK2 -- .selection/from POK2 ( decr ) .selection/from LDZ2 DUP2 .selection/to STZ2 -- .selection/from STZ2
.selection/from PEK2 LDA #00 NEQ ,&loop JCN .selection/from LDZ2 LDA #00 NEQ ,&loop JCN
( clamp at document body ) ( clamp at document body )
.selection/from PEK2 ;document/body GTH2 RTN? .selection/from LDZ2 ;document/body GTH2 RTN?
;document/body DUP2 .selection/from POK2 ++ .selection/to POK2 ;document/body DUP2 .selection/from STZ2 ++ .selection/to STZ2
RTN RTN
@goto-lineend ( -- ) @goto-lineend ( -- )
&loop &loop
.selection/from PEK2 LDA #0a EQU RTN? .selection/from LDZ2 LDA #0a EQU RTN?
.selection/from PEK2 LDA #0d EQU RTN? .selection/from LDZ2 LDA #0d EQU RTN?
( incr ) .selection/from PEK2 ++ DUP2 ++ .selection/to POK2 .selection/from POK2 ( incr ) .selection/from LDZ2 ++ DUP2 ++ .selection/to STZ2 .selection/from STZ2
.selection/from PEK2 LDA #00 NEQ ,&loop JCN .selection/from LDZ2 LDA #00 NEQ ,&loop JCN
( clamp at document body ) ( clamp at document body )
.selection/from PEK2 ;document/eof LTH2 RTN? .selection/from LDZ2 ;document/eof LTH2 RTN?
;document/eof -- DUP2 .selection/from POK2 ++ .selection/to POK2 ;document/eof -- DUP2 .selection/from STZ2 ++ .selection/to STZ2
RTN RTN
@find-wordstart ( -- ) @find-wordstart ( -- )
.selection/to PEK2 .j POK2 .selection/to LDZ2 .j STZ2
&loop &loop
( decr ) .j PEK2 -- .j POK2 ( decr ) .j LDZ2 -- .j STZ2
.j PEK2 LDA #20 EQU ,&end JCN .j LDZ2 LDA #20 EQU ,&end JCN
.j PEK2 LDA #0a EQU ,&end JCN .j LDZ2 LDA #0a EQU ,&end JCN
.j PEK2 LDA #0d EQU ,&end JCN .j LDZ2 LDA #0d EQU ,&end JCN
.j PEK2 ;document/body GTH2 ,&loop JCN .j LDZ2 ;document/body GTH2 ,&loop JCN
&end &end
( return ) .j PEK2 -- ( return ) .j LDZ2 --
RTN RTN
@find-wordend ( -- ) @find-wordend ( -- )
.selection/to PEK2 .j POK2 .selection/to LDZ2 .j STZ2
&loop &loop
( incr ) .j PEK2 ++ .j POK2 ( incr ) .j LDZ2 ++ .j STZ2
.j PEK2 LDA #20 EQU ,&end JCN .j LDZ2 LDA #20 EQU ,&end JCN
.j PEK2 LDA #0a EQU ,&end JCN .j LDZ2 LDA #0a EQU ,&end JCN
.j PEK2 LDA #0d EQU ,&end JCN .j LDZ2 LDA #0d EQU ,&end JCN
.j PEK2 ;document/body GTH2 ,&loop JCN .j LDZ2 ;document/body GTH2 ,&loop JCN
&end &end
( return ) .j PEK2 ++ ( return ) .j LDZ2 ++
RTN RTN
@find-lineoffset ( return character offset from linestart ) @find-lineoffset ( return character offset from linestart )
#0000 .j POK2 #0000 .j STZ2
&loop &loop
( incr ) .j PEK2 ++ .j POK2 ( incr ) .j LDZ2 ++ .j STZ2
.selection/from PEK2 .j PEK2 SUB2 LDA #0a EQU ,&end JCN .selection/from LDZ2 .j LDZ2 SUB2 LDA #0a EQU ,&end JCN
.selection/from PEK2 .j PEK2 SUB2 LDA #0d EQU ,&end JCN .selection/from LDZ2 .j LDZ2 SUB2 LDA #0d EQU ,&end JCN
.selection/from PEK2 .j PEK2 SUB2 ;document/body GTH2 ,&loop JCN .selection/from LDZ2 .j LDZ2 SUB2 ;document/body GTH2 ,&loop JCN
&end &end
( return ) .j PEK2 ( return ) .j LDZ2
RTN RTN
@find-line ( position -> addr ) @find-line ( position -> addr )
;document/body .j POK2 #0000 .pt/y POK2 ;document/body .j STZ2 #0000 .pt/y STZ2
&loop &loop
.pt/y PEK2 .position/y PEK2 -- GTH2 ,&end JCN .pt/y LDZ2 .position/y LDZ2 -- GTH2 ,&end JCN
.j PEK2 LDA #0a NEQ .j PEK2 LDA #0d NEQ #0101 EQU2 ,&no-space JCN .j LDZ2 LDA #0a NEQ .j LDZ2 LDA #0d NEQ #0101 EQU2 ,&no-space JCN
( incr ) .pt/y PEK2 ++ .pt/y POK2 ( incr ) .pt/y LDZ2 ++ .pt/y STZ2
&no-space &no-space
( incr ) .j PEK2 ++ .j POK2 ( incr ) .j LDZ2 ++ .j STZ2
.j PEK2 LDA #00 NEQ ,&loop JCN .j LDZ2 LDA #00 NEQ ,&loop JCN
&end &end
( return ) .j PEK2 ( return ) .j LDZ2
RTN RTN
@find-selection ( position -> addr ) @find-selection ( position -> addr )
;find-line JSR2 ( find line ) ;find-line JSR2 ( find line )
#0000 .pt/x POK2 #0000 .pt/x STZ2
&loop &loop
.j PEK2 .pt/x PEK2 ADD2 LDA #0a EQU ,&end JCN .j LDZ2 .pt/x LDZ2 ADD2 LDA #0a EQU ,&end JCN
.j PEK2 .pt/x PEK2 ADD2 LDA #0d EQU ,&end JCN .j LDZ2 .pt/x LDZ2 ADD2 LDA #0d EQU ,&end JCN
( incr ) .pt/x PEK2 ++ .pt/x POK2 ( incr ) .pt/x LDZ2 ++ .pt/x STZ2
.pt/x PEK2 .position/x PEK2 -- LTH2 ,&loop JCN .pt/x LDZ2 .position/x LDZ2 -- LTH2 ,&loop JCN
&end &end
( return ) .pt/x PEK2 ADD2 ( return ) .pt/x LDZ2 ADD2
RTN RTN
@cut ( -- ) @cut ( -- )
;copy JSR2 ;copy JSR2
.selection/to PEK2 .selection/from PEK2 SUB2 ;shift-left JSR2 .selection/to LDZ2 .selection/from LDZ2 SUB2 ;shift-left JSR2
.selection/from PEK2 ++ .selection/to POK2 .selection/from LDZ2 ++ .selection/to STZ2
RTN RTN
@copy ( -- ) @copy ( -- )
#0000 .i POK2 ( start ) #0000 .i STZ2 ( start )
.selection/to PEK2 .selection/from PEK2 SUB2 .j POK2 ( end ) .selection/to LDZ2 .selection/from LDZ2 SUB2 .j STZ2 ( end )
.j PEK2 ;clip/len STA2 .j LDZ2 ;clip/len STA2
&loop &loop
.selection/from PEK2 .i PEK2 ADD2 LDA ;clip/body .i PEK2 ADD2 STA .selection/from LDZ2 .i LDZ2 ADD2 LDA ;clip/body .i LDZ2 ADD2 STA
( incr ) .i PEK2 ++ .i POK2 ( incr ) .i LDZ2 ++ .i STZ2
.i PEK2 .j PEK2 LTH2 ,&loop JCN .i LDZ2 .j LDZ2 LTH2 ,&loop JCN
RTN RTN
@paste ( -- ) @paste ( -- )
;clip/len LDA2 ;shift-right JSR2 ;clip/len LDA2 ;shift-right JSR2
#0000 .i POK2 ( start ) #0000 .i STZ2 ( start )
;clip/len LDA2 .j POK2 ( end ) ;clip/len LDA2 .j STZ2 ( end )
&loop &loop
;clip/body .i PEK2 ADD2 LDA .selection/from PEK2 .i PEK2 ADD2 STA ;clip/body .i LDZ2 ADD2 LDA .selection/from LDZ2 .i LDZ2 ADD2 STA
( incr ) .i PEK2 ++ .i POK2 ( incr ) .i LDZ2 ++ .i STZ2
.i PEK2 .j PEK2 LTH2 ,&loop JCN .i LDZ2 .j LDZ2 LTH2 ,&loop JCN
RTN RTN
@select ( position -> selection ) @select ( position -> selection )
;document/body .selection/from POK2 #0000 .pt/x POK2 #0000 .pt/y POK2 ;document/body .selection/from STZ2 #0000 .pt/x STZ2 #0000 .pt/y STZ2
&loop &loop
.selection/from PEK2 LDA #0a NEQ .selection/from PEK2 LDA #0d NEQ #0101 EQU2 ,&no-space JCN .selection/from LDZ2 LDA #0a NEQ .selection/from LDZ2 LDA #0d NEQ #0101 EQU2 ,&no-space JCN
( incr ) .pt/y PEK2 ++ .pt/y POK2 ( incr ) .pt/y LDZ2 ++ .pt/y STZ2
#0000 .pt/x POK2 #0000 .pt/x STZ2
&no-space &no-space
.pt/y PEK2 .position/y PEK2 -- GTH2 .pt/x PEK2 .position/x PEK2 -- GTH2 #0101 NEQ2 ,&no-reached JCN .pt/y LDZ2 .position/y LDZ2 -- GTH2 .pt/x LDZ2 .position/x LDZ2 -- GTH2 #0101 NEQ2 ,&no-reached JCN
.selection/from PEK2 ++ .selection/to POK2 .selection/from LDZ2 ++ .selection/to STZ2
RTN RTN
&no-reached &no-reached
( incr ) .pt/x PEK2 ++ .pt/x POK2 ( incr ) .pt/x LDZ2 ++ .pt/x STZ2
( incr ) .selection/from PEK2 ++ .selection/from POK2 ( incr ) .selection/from LDZ2 ++ .selection/from STZ2
.selection/from PEK2 LDA #00 NEQ ,&loop JCN .selection/from LDZ2 LDA #00 NEQ ,&loop JCN
RTN RTN
@ -476,7 +476,7 @@ RTN
@draw-short ( short ) @draw-short ( short )
.addr POK2 .addr STZ2
;font_hex #00 ;addr LDA #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2 ;font_hex #00 ;addr LDA #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
( draw ) #2e .Screen/color DEO ( draw ) #2e .Screen/color DEO
.Screen/x DEI2 8+ .Screen/x DEO2 .Screen/x DEI2 8+ .Screen/x DEO2
@ -494,18 +494,18 @@ RTN
@draw-cursor @draw-cursor
( clear last cursor ) ( clear last cursor )
.mouse/x PEK2 .Screen/x DEO2 .mouse/x LDZ2 .Screen/x DEO2
.mouse/y PEK2 .Screen/y DEO2 .mouse/y LDZ2 .Screen/y DEO2
;blank_icn .Screen/addr DEO2 ;blank_icn .Screen/addr DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record mouse positions ) ( record mouse positions )
.Mouse/x DEI2 .mouse/x POK2 .Mouse/x DEI2 .mouse/x STZ2
.Mouse/y DEI2 .mouse/y POK2 .Mouse/y DEI2 .mouse/y STZ2
( draw new cursor ) ( draw new cursor )
.mouse/x PEK2 .Screen/x DEO2 .mouse/x LDZ2 .Screen/x DEO2
.mouse/y PEK2 .Screen/y DEO2 .mouse/y LDZ2 .Screen/y DEO2
;cursor_icn .Screen/addr DEO2 ;cursor_icn .Screen/addr DEO2
#3f .Mouse/state DEI #01 EQU #0a MUL SUB .Screen/color DEO #3f .Mouse/state DEI #01 EQU #0a MUL SUB .Screen/color DEO
@ -513,32 +513,32 @@ RTN
@draw-textarea ( x y color addr ) @draw-textarea ( x y color addr )
;document/body .textarea/addr POK2 ;document/body .textarea/addr STZ2
( scroll to position ) ( scroll to position )
#0000 .j POK2 ( j is linebreaks ) #0000 .j STZ2 ( j is linebreaks )
&find-offset &find-offset
.scroll/y PEK2 .j PEK2 EQU2 ,&find-offset-end JCN .scroll/y LDZ2 .j LDZ2 EQU2 ,&find-offset-end JCN
.textarea/addr PEK2 LDA #0a NEQ .textarea/addr PEK2 LDA #0d NEQ #0101 EQU2 ,&no-break JCN .textarea/addr LDZ2 LDA #0a NEQ .textarea/addr LDZ2 LDA #0d NEQ #0101 EQU2 ,&no-break JCN
( incr ) .j PEK2 ++ .j POK2 &no-break ( incr ) .j LDZ2 ++ .j STZ2 &no-break
( incr ) .textarea/addr PEK2 ++ .textarea/addr POK2 ( incr ) .textarea/addr LDZ2 ++ .textarea/addr STZ2
.textarea/addr PEK2 LDA #00 NEQ ,&find-offset JCN .textarea/addr LDZ2 LDA #00 NEQ ,&find-offset JCN
&find-offset-end &find-offset-end
#0018 .Screen/x DEO2 #0000 .Screen/y DEO2 #0018 .Screen/x DEO2 #0000 .Screen/y DEO2
.textarea/addr PEK2 .i POK2 .textarea/addr LDZ2 .i STZ2
&loop &loop
.Screen/y DEI2 .Screen/height DEI2 #0010 SUB2 GTH2 ;&end JCN2 .Screen/y DEI2 .Screen/height DEI2 #0010 SUB2 GTH2 ;&end JCN2
.i PEK2 LDA #0a NEQ .i PEK2 LDA #0d NEQ #0101 EQU2 ;&no-linebreak JCN2 .i LDZ2 LDA #0a NEQ .i LDZ2 LDA #0d NEQ #0101 EQU2 ;&no-linebreak JCN2
( draw linebreak ) ( draw linebreak )
;linebreak_icn .Screen/addr DEO2 ;linebreak_icn .Screen/addr DEO2
( draw ) #02 ( draw ) #02
.i PEK2 .selection/from PEK2 -- GTH2 .i LDZ2 .selection/from LDZ2 -- GTH2
.i PEK2 .selection/to PEK2 LTH2 #0101 EQU2 .i LDZ2 .selection/to LDZ2 LTH2 #0101 EQU2
#26 MUL ADD .Screen/color DEO #26 MUL ADD .Screen/color DEO
( fill clear ) ( fill clear )
&fill-clear &fill-clear
@ -549,13 +549,13 @@ RTN
( draw line number ) ( draw line number )
#0000 .Screen/x DEO2 #0000 .Screen/x DEO2
.scroll/y PEK2 .Screen/y DEI2 8/ ADD2 DUP2 SWP POP .k POK .scroll/y LDZ2 .Screen/y DEI2 8/ ADD2 DUP2 SWP POP .k STZ
.position/y PEK2 EQU2 #05 MUL .l POK .position/y LDZ2 EQU2 #05 MUL .l STZ
;font_hex #00 .k PEK #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2 ;font_hex #00 .k LDZ #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
#24 .l PEK ADD .Screen/color DEO #24 .l LDZ ADD .Screen/color DEO
#0008 .Screen/x DEO2 #0008 .Screen/x DEO2
;font_hex #00 .k PEK #0f AND #08 MUL ADD2 .Screen/addr DEO2 ;font_hex #00 .k LDZ #0f AND #08 MUL ADD2 .Screen/addr DEO2
#24 .l PEK ADD .Screen/color DEO #24 .l LDZ ADD .Screen/color DEO
#0010 .Screen/x DEO2 #0010 .Screen/x DEO2
( incr ) .Screen/y DEI2 8+ .Screen/y DEO2 ( incr ) .Screen/y DEI2 8+ .Screen/y DEO2
@ -563,19 +563,19 @@ RTN
( get character ) ( get character )
;font #00 .i PEK2 LDA #20 SUB 8* ADD2 .Screen/addr DEO2 ;font #00 .i LDZ2 LDA #20 SUB 8* ADD2 .Screen/addr DEO2
( is a special character ) ( is a special character )
.i PEK2 LDA #20 GTH ,&no-tab JCN ;font .Screen/addr DEO2 &no-tab .i LDZ2 LDA #20 GTH ,&no-tab JCN ;font .Screen/addr DEO2 &no-tab
( draw ) #21 ( draw ) #21
.i PEK2 .selection/from PEK2 -- GTH2 .i LDZ2 .selection/from LDZ2 -- GTH2
.i PEK2 .selection/to PEK2 LTH2 #0101 EQU2 .i LDZ2 .selection/to LDZ2 LTH2 #0101 EQU2
#05 MUL ADD .Screen/color DEO #05 MUL ADD .Screen/color DEO
( incr ) .i PEK2 ++ .i POK2 ( incr ) .i LDZ2 ++ .i STZ2
( incr ) .Screen/x DEI2 #0007 ADD2 .Screen/x DEO2 ( incr ) .Screen/x DEI2 #0007 ADD2 .Screen/x DEO2
.i PEK2 LDA #00 NEQ ;&loop JCN2 .i LDZ2 LDA #00 NEQ ;&loop JCN2
&end &end
@ -596,7 +596,7 @@ RTN
OVR2 OVR2 LTH2 ,&loop JCN OVR2 OVR2 LTH2 ,&loop JCN
POP2 POP2 POP2 POP2
.scroll/y PEK2 8+ .Screen/y DEO2 .scroll/y LDZ2 8+ .Screen/y DEO2
DUP2 #0008 ADD2 .Screen/addr DEO2 DUP2 #0008 ADD2 .Screen/addr DEO2
( draw ) #21 .Screen/color DEO ( draw ) #21 .Screen/color DEO
@ -613,16 +613,16 @@ RTN
@draw-titlebar @draw-titlebar
#0018 .Screen/height DEI2 8- #29 ;filepath #0018 .Screen/height DEI2 8- #29 ;filepath
( load ) .label/addr POK2 .label/color POK .Screen/y DEO2 .Screen/x DEO2 ( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2 .Screen/x DEO2
.label/addr PEK2 .label/addr LDZ2
&loop &loop
( draw ) DUP2 LDA #00 SWP #20 SUB 8* ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO ( draw ) DUP2 LDA #00 SWP #20 SUB 8* ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/color DEO
( incr ) ++ ( incr ) ++
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2 ( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
DUP2 LDA #00 NEQ ,&loop JCN DUP2 LDA #00 NEQ ,&loop JCN
POP2 POP2
( selection ) ( selection )
.selection/from PEK2 ;document/body SUB2 ;draw-short JSR2 .selection/from LDZ2 ;document/body SUB2 ;draw-short JSR2
RTN RTN

View File

@ -103,31 +103,31 @@
;on-transfer .File/vector DEO2 ;on-transfer .File/vector DEO2
( set defaults ) ( set defaults )
#0130 .frame/width POK2 #0130 .frame/width STZ2
#00a8 .frame/height POK2 #00a8 .frame/height STZ2
#01 .settings/brush POK #01 .settings/brush STZ
#32 .settings/ratio POK #32 .settings/ratio STZ
.Screen/width DEI2 #0001 SFT2 .frame/width PEK2 #0001 SFT2 SUB2 .Screen/width DEI2 #0001 SFT2 .frame/width LDZ2 #0001 SFT2 SUB2
.Screen/height DEI2 #0001 SFT2 .frame/height PEK2 #0001 SFT2 SUB2 #0010 ADD2 .Screen/height DEI2 #0001 SFT2 .frame/height LDZ2 #0001 SFT2 SUB2 #0010 ADD2
.frame/width PEK2 .frame/height PEK2 .frame/width LDZ2 .frame/height LDZ2
SIZE-TO-RECT ;frame SET-RECT SIZE-TO-RECT ;frame SET-RECT
.frame/x1 PEK2 #0010 ADD2 .bankview/x POK2 .frame/x1 LDZ2 #0010 ADD2 .bankview/x STZ2
.frame/y1 PEK2 .bankview/y POK2 .frame/y1 LDZ2 .bankview/y STZ2
BANK .settings/page POK2 BANK .settings/page STZ2
.frame/x2 PEK2 #0098 SUB2 .tileview/x POK2 .frame/x2 LDZ2 #0098 SUB2 .tileview/x STZ2
.frame/y1 PEK2 .tileview/y POK2 .frame/y1 LDZ2 .tileview/y STZ2
BANK #0448 ADD2 .settings/tile POK2 BANK #0448 ADD2 .settings/tile STZ2
.frame/x2 PEK2 #0010 SUB2 .frame/y1 PEK2 #0010 #0080 SIZE-TO-RECT ;dataview SET-RECT .frame/x2 LDZ2 #0010 SUB2 .frame/y1 LDZ2 #0010 #0080 SIZE-TO-RECT ;dataview SET-RECT
.frame/x1 PEK2 #0010 ADD2 .frame/y2 PEK2 #0020 SUB2 #0020 #0020 SIZE-TO-RECT ;blendview SET-RECT .frame/x1 LDZ2 #0010 ADD2 .frame/y2 LDZ2 #0020 SUB2 #0020 #0020 SIZE-TO-RECT ;blendview SET-RECT
.frame/x1 PEK2 #0060 ADD2 .frame/y2 PEK2 #0020 SUB2 #0020 #0020 SIZE-TO-RECT ;colorview SET-RECT .frame/x1 LDZ2 #0060 ADD2 .frame/y2 LDZ2 #0020 SUB2 #0020 #0020 SIZE-TO-RECT ;colorview SET-RECT
.frame/x1 PEK2 #0038 ADD2 .frame/y2 PEK2 #0020 SUB2 #0020 #0020 SIZE-TO-RECT ;preview SET-RECT .frame/x1 LDZ2 #0038 ADD2 .frame/y2 LDZ2 #0020 SUB2 #0020 #0020 SIZE-TO-RECT ;preview SET-RECT
.frame/x2 PEK2 #0098 SUB2 .frame/y1 PEK2 #0080 #0080 SIZE-TO-RECT ;editview SET-RECT .frame/x2 LDZ2 #0098 SUB2 .frame/y1 LDZ2 #0080 #0080 SIZE-TO-RECT ;editview SET-RECT
#01 .settings/blending POK #01 .settings/blending STZ
;filepath1 .File/name DEO2 #0800 .File/length DEO2 BANK .File/load DEO2 ;filepath1 .File/name DEO2 #0800 .File/length DEO2 BANK .File/load DEO2
;filepath2 .File/name DEO2 #0800 .File/length DEO2 BANK #0800 ADD2 .File/load DEO2 ;filepath2 .File/name DEO2 #0800 .File/length DEO2 BANK #0800 ADD2 .File/load DEO2
@ -136,7 +136,7 @@
;filepath5 .File/name DEO2 #1000 .File/length DEO2 BANK #2800 ADD2 .File/load DEO2 ;filepath5 .File/name DEO2 #1000 .File/length DEO2 BANK #2800 ADD2 .File/load DEO2
;filepath6 .File/name DEO2 #1000 .File/length DEO2 BANK #3800 ADD2 .File/load DEO2 ;filepath6 .File/name DEO2 #1000 .File/length DEO2 BANK #3800 ADD2 .File/load DEO2
#40 DUP .bankview/selection POK ;select-tile JSR2 #40 DUP .bankview/selection STZ ;select-tile JSR2
BRK BRK
@ -150,28 +150,28 @@ BRK
( skip ) .Controller/button DEI #00 NEQ #01 JCN [ BRK ] ( skip ) .Controller/button DEI #00 NEQ #01 JCN [ BRK ]
.Controller/button DEI #11 NEQ ,&no-pageup JCN .settings/page PEK2 .Controller/button DEI #11 NEQ ,&no-pageup JCN .settings/page LDZ2
#0800 SUB2 .settings/page POK2 #0800 SUB2 .settings/page STZ2
;redraw JSR2 ;redraw JSR2
BRK &no-pageup BRK &no-pageup
.Controller/button DEI #21 NEQ ,&no-pagedown JCN .settings/page PEK2 .Controller/button DEI #21 NEQ ,&no-pagedown JCN .settings/page LDZ2
#0800 ADD2 .settings/page POK2 #0800 ADD2 .settings/page STZ2
;redraw JSR2 ;redraw JSR2
BRK &no-pagedown BRK &no-pagedown
.Controller/button DEI #f0 AND .Controller/button DEI #f0 AND
DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN
( move ) .bankview/selection PEK #10 SUB .bankview/selection POK &no-up ( move ) .bankview/selection LDZ #10 SUB .bankview/selection STZ &no-up
DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN
( move ) .bankview/selection PEK #10 ADD .bankview/selection POK &no-down ( move ) .bankview/selection LDZ #10 ADD .bankview/selection STZ &no-down
DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN
( move ) .bankview/selection PEK #01 SUB .bankview/selection POK &no-left ( move ) .bankview/selection LDZ #01 SUB .bankview/selection STZ &no-left
DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN
( move ) .bankview/selection PEK #01 ADD .bankview/selection POK &no-right ( move ) .bankview/selection LDZ #01 ADD .bankview/selection STZ &no-right
POP POP
.bankview/selection PEK ;select-tile JSR2 .bankview/selection LDZ ;select-tile JSR2
BRK BRK
@ -182,13 +182,13 @@ BRK
( skip ) .Mouse/state DEI #00 NEQ #01 JCN [ BRK ] ( skip ) .Mouse/state DEI #00 NEQ #01 JCN [ BRK ]
( toolbar ) ( toolbar )
.Mouse/y DEI2 .bankview/y PEK2 #0010 SUB2 SUB2 #0008 DIV2 #0000 NEQ2 ;&no-toolbar-click JCN2 .Mouse/y DEI2 .bankview/y LDZ2 #0010 SUB2 SUB2 #0008 DIV2 #0000 NEQ2 ;&no-toolbar-click JCN2
( brush ) ( brush )
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 #000d LTH2 ,&no-brush-click JCN .Mouse/x DEI2 .bankview/x LDZ2 SUB2 #0008 DIV2 #000d LTH2 ,&no-brush-click JCN
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 #000f GTH2 ,&no-brush-click JCN .Mouse/x DEI2 .bankview/x LDZ2 SUB2 #0008 DIV2 #000f GTH2 ,&no-brush-click JCN
( select ) .mouse/x PEK2 .bankview/x PEK2 SUB2 #0008 DIV2 #000d SUB2 TOB .bankview/mode POK ( select ) .mouse/x LDZ2 .bankview/x LDZ2 SUB2 #0008 DIV2 #000d SUB2 TOB .bankview/mode STZ
&no-brush-click &no-brush-click
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 #0005 NEQ2 ,&no-toggle-depth JCN .Mouse/x DEI2 .bankview/x LDZ2 SUB2 #0008 DIV2 #0005 NEQ2 ,&no-toggle-depth JCN
;toggle-depth JSR2 ;toggle-depth JSR2
&no-toggle-depth &no-toggle-depth
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
@ -196,77 +196,77 @@ BRK
&no-toolbar-click &no-toolbar-click
( bankview ) ( bankview )
.Mouse/x DEI2 .bankview/x PEK2 GTH2 .Mouse/x DEI2 .bankview/x PEK2 #0080 ADD2 LTH2 #0101 EQU2 .Mouse/x DEI2 .bankview/x LDZ2 GTH2 .Mouse/x DEI2 .bankview/x LDZ2 #0080 ADD2 LTH2 #0101 EQU2
.Mouse/y DEI2 .bankview/y PEK2 GTH2 .Mouse/y DEI2 .bankview/y PEK2 #0080 ADD2 LTH2 #0101 EQU2 .Mouse/y DEI2 .bankview/y LDZ2 GTH2 .Mouse/y DEI2 .bankview/y LDZ2 #0080 ADD2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-bankview JCN2 #0101 EQU2 ;on-touch-bankview JCN2
( tileview ) ( tileview )
.Mouse/x DEI2 .tileview/x PEK2 GTH2 .Mouse/x DEI2 .tileview/x PEK2 #0080 ADD2 LTH2 #0101 EQU2 .Mouse/x DEI2 .tileview/x LDZ2 GTH2 .Mouse/x DEI2 .tileview/x LDZ2 #0080 ADD2 LTH2 #0101 EQU2
.Mouse/y DEI2 .tileview/y PEK2 GTH2 .Mouse/y DEI2 .tileview/y PEK2 #0080 ADD2 LTH2 #0101 EQU2 .Mouse/y DEI2 .tileview/y LDZ2 GTH2 .Mouse/y DEI2 .tileview/y LDZ2 #0080 ADD2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-tileview JCN2 #0101 EQU2 ;on-touch-tileview JCN2
( editview ) ( editview )
.Mouse/x DEI2 DUP2 .editview/x1 PEK2 GTH2 ROT ROT .editview/x2 PEK2 LTH2 #0101 EQU2 .Mouse/x DEI2 DUP2 .editview/x1 LDZ2 GTH2 ROT ROT .editview/x2 LDZ2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .editview/y1 PEK2 GTH2 ROT ROT .editview/y2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 DUP2 .editview/y1 LDZ2 GTH2 ROT ROT .editview/y2 LDZ2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-editview JCN2 #0101 EQU2 ;on-touch-editview JCN2
( dataview ) ( dataview )
.Mouse/x DEI2 DUP2 .dataview/x1 PEK2 GTH2 ROT ROT .dataview/x2 PEK2 LTH2 #0101 EQU2 .Mouse/x DEI2 DUP2 .dataview/x1 LDZ2 GTH2 ROT ROT .dataview/x2 LDZ2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .dataview/y1 PEK2 GTH2 ROT ROT .dataview/y2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 DUP2 .dataview/y1 LDZ2 GTH2 ROT ROT .dataview/y2 LDZ2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-dataview JCN2 #0101 EQU2 ;on-touch-dataview JCN2
( blendbiew ) ( blendbiew )
.Mouse/x DEI2 DUP2 .blendview/x1 PEK2 GTH2 ROT ROT .blendview/x2 PEK2 LTH2 #0101 EQU2 .Mouse/x DEI2 DUP2 .blendview/x1 LDZ2 GTH2 ROT ROT .blendview/x2 LDZ2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .blendview/y1 PEK2 GTH2 ROT ROT .blendview/y2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 DUP2 .blendview/y1 LDZ2 GTH2 ROT ROT .blendview/y2 LDZ2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-blendview JCN2 #0101 EQU2 ;on-touch-blendview JCN2
( colorview ) ( colorview )
.Mouse/x DEI2 DUP2 .colorview/x1 PEK2 GTH2 ROT ROT .colorview/x2 PEK2 LTH2 #0101 EQU2 .Mouse/x DEI2 DUP2 .colorview/x1 LDZ2 GTH2 ROT ROT .colorview/x2 LDZ2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .colorview/y1 PEK2 GTH2 ROT ROT .colorview/y2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 DUP2 .colorview/y1 LDZ2 GTH2 ROT ROT .colorview/y2 LDZ2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-colorview JCN2 #0101 EQU2 ;on-touch-colorview JCN2
( preview ) ( preview )
.Mouse/x DEI2 DUP2 .preview/x1 PEK2 GTH2 ROT ROT .preview/x2 PEK2 LTH2 #0101 EQU2 .Mouse/x DEI2 DUP2 .preview/x1 LDZ2 GTH2 ROT ROT .preview/x2 LDZ2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .preview/y1 PEK2 GTH2 ROT ROT .preview/y2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 DUP2 .preview/y1 LDZ2 GTH2 ROT ROT .preview/y2 LDZ2 LTH2 #0101 EQU2
#0101 EQU2 ;on-touch-preview JCN2 #0101 EQU2 ;on-touch-preview JCN2
BRK BRK
@on-touch-bankview ( -> ) @on-touch-bankview ( -> )
.bankview/mode PEK #01 NEQ ,&not-copy-mode JCN .bankview/mode LDZ #01 NEQ ,&not-copy-mode JCN
#00 .i POK #00 .i STZ
&copy-loop &copy-loop
( load ) .settings/tile PEK2 .i PEK ADD LDA ( load ) .settings/tile LDZ2 .i LDZ ADD LDA
( get touch addr ) ( get touch addr )
.Mouse/x DEI2 .bankview/x PEK2 SUB2 STEP8 .Mouse/x DEI2 .bankview/x LDZ2 SUB2 STEP8
.Mouse/y DEI2 .bankview/y PEK2 SUB2 STEP8 #0010 MUL2 ADD2 .Mouse/y DEI2 .bankview/y LDZ2 SUB2 STEP8 #0010 MUL2 ADD2
( 2-bit mode ) #00 .settings/depth PEK #01 ADD MUL2 ( 2-bit mode ) #00 .settings/depth LDZ #01 ADD MUL2
.settings/page PEK2 ADD2 #00 .i PEK ADD2 STA .settings/page LDZ2 ADD2 #00 .i LDZ ADD2 STA
( incr ) .i PEK #01 ADD .i POK ( incr ) .i LDZ #01 ADD .i STZ
.i PEK #08 LTH ,&copy-loop JCN .i LDZ #08 LTH ,&copy-loop JCN
;redraw JSR2 BRK ;redraw JSR2 BRK
&not-copy-mode &not-copy-mode
.bankview/mode PEK #02 NEQ ,&not-erase-mode JCN .bankview/mode LDZ #02 NEQ ,&not-erase-mode JCN
#00 .i POK #00 .i STZ
&erase-loop &erase-loop
#00 #00
( get touch addr ) ( get touch addr )
.Mouse/x DEI2 .bankview/x PEK2 SUB2 STEP8 .Mouse/x DEI2 .bankview/x LDZ2 SUB2 STEP8
.Mouse/y DEI2 .bankview/y PEK2 SUB2 STEP8 #0010 MUL2 ADD2 .Mouse/y DEI2 .bankview/y LDZ2 SUB2 STEP8 #0010 MUL2 ADD2
( 2-bit mode ) #00 .settings/depth PEK #01 ADD MUL2 ( 2-bit mode ) #00 .settings/depth LDZ #01 ADD MUL2
.settings/page PEK2 ADD2 #00 .i PEK ADD2 STA .settings/page LDZ2 ADD2 #00 .i LDZ ADD2 STA
( incr ) .i PEK #01 ADD .i POK ( incr ) .i LDZ #01 ADD .i STZ
.i PEK #08 LTH ,&erase-loop JCN .i LDZ #08 LTH ,&erase-loop JCN
;redraw JSR2 BRK ;redraw JSR2 BRK
&not-erase-mode &not-erase-mode
( select ) ( select )
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 TOB .Mouse/x DEI2 .bankview/x LDZ2 SUB2 #0008 DIV2 TOB
.Mouse/y DEI2 .bankview/y PEK2 SUB2 #0008 DIV2 TOB #40 SFT ADD .Mouse/y DEI2 .bankview/y LDZ2 SUB2 #0008 DIV2 TOB #40 SFT ADD
DUP .bankview/selection POK DUP .bankview/selection STZ
;select-tile JSR2 ;select-tile JSR2
BRK BRK
@ -284,8 +284,8 @@ BRK
@on-touch-dataview ( -> ) @on-touch-dataview ( -> )
.Mouse/y DEI2 .dataview/y1 PEK2 SUB2 STEP8 TOB #60 EQU ,&skip JCN BRK &skip .Mouse/y DEI2 .dataview/y1 LDZ2 SUB2 STEP8 TOB #60 EQU ,&skip JCN BRK &skip
.Mouse/x DEI2 .dataview/x1 PEK2 SUB2 #0008 DIV2 TOB .Mouse/x DEI2 .dataview/x1 LDZ2 SUB2 #0008 DIV2 TOB
DUP #00 NEQ ,&no-move-up JCN DUP #00 NEQ ,&no-move-up JCN
;op_shiftup JSR2 ;op_shiftup JSR2
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
@ -300,9 +300,9 @@ BRK
@on-touch-blendview ( -> ) @on-touch-blendview ( -> )
.Mouse/x DEI2 .blendview/x1 PEK2 SUB2 #0008 DIV2 TOB .Mouse/x DEI2 .blendview/x1 LDZ2 SUB2 #0008 DIV2 TOB
.Mouse/y DEI2 .blendview/y1 PEK2 SUB2 #0008 DIV2 TOB #04 MUL ADD .Mouse/y DEI2 .blendview/y1 LDZ2 SUB2 #0008 DIV2 TOB #04 MUL ADD
.settings/blending POK .settings/blending STZ
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;redraw JSR2 ;redraw JSR2
@ -310,10 +310,10 @@ BRK
@on-touch-colorview ( -> ) @on-touch-colorview ( -> )
( channel ) .Mouse/y DEI2 .colorview/y1 PEK2 SUB2 #0008 DIV2 TOB STH ( channel ) .Mouse/y DEI2 .colorview/y1 LDZ2 SUB2 #0008 DIV2 TOB STH
( rgb ) .Mouse/x DEI2 .colorview/x1 PEK2 SUB2 #0008 DIV2 TOB ( rgb ) .Mouse/x DEI2 .colorview/x1 LDZ2 SUB2 #0008 DIV2 TOB
DUP #00 NEQ ,&no-brush JCN DUP #00 NEQ ,&no-brush JCN
DUPr STHr .settings/brush POK &no-brush DUPr STHr .settings/brush STZ &no-brush
DUP #01 NEQ ,&no-red JCN DUP #01 NEQ ,&no-red JCN
DUPr STHr .System/r ;set-color JSR2 &no-red DUPr STHr .System/r ;set-color JSR2 &no-red
DUP #02 NEQ ,&no-green JCN DUP #02 NEQ ,&no-green JCN
@ -328,11 +328,11 @@ BRK
@on-touch-preview ( -> ) @on-touch-preview ( -> )
( y ) .Mouse/y DEI2 .preview/y1 PEK2 SUB2 #0008 DIV2 TOB ( y ) .Mouse/y DEI2 .preview/y1 LDZ2 SUB2 #0008 DIV2 TOB
( x ) .Mouse/x DEI2 .preview/x1 PEK2 SUB2 #0008 DIV2 TOB ( x ) .Mouse/x DEI2 .preview/x1 LDZ2 SUB2 #0008 DIV2 TOB
#40 SFT ADD #11 ADD #40 SFT ADD #11 ADD
.settings/ratio POK .settings/ratio STZ
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;redraw JSR2 ;redraw JSR2
@ -372,45 +372,45 @@ RTN
( x y ) DUP #0f AND SWP #04 SFT ( x y ) DUP #0f AND SWP #04 SFT
( y ) #10 MOD #10 MUL #00 SWP #0008 MUL2 ( y ) #10 MOD #10 MUL #00 SWP #0008 MUL2
( x ) ROT #10 MOD #00 SWP #0008 MUL2 ADD2 ( x ) ROT #10 MOD #00 SWP #0008 MUL2 ADD2
( 2-bit mode ) #00 .settings/depth PEK #01 ADD MUL2 ( 2-bit mode ) #00 .settings/depth LDZ #01 ADD MUL2
( offset ) .settings/page PEK2 ADD2 .settings/tile POK2 ( offset ) .settings/page LDZ2 ADD2 .settings/tile STZ2
;redraw JSR2 ;redraw JSR2
RTN RTN
@toggle-depth ( -- ) @toggle-depth ( -- )
.bankview/selection PEK .bankview/selection LDZ
.settings/depth PEK #00 EQU .settings/depth POK .settings/depth LDZ #00 EQU .settings/depth STZ
;select-tile JSR2 ;select-tile JSR2
RTN RTN
@op_shiftup ( -- ) @op_shiftup ( -- )
.settings/tile PEK2 LDA .settings/tile LDZ2 LDA
.settings/tile PEK2 #0001 ADD2 LDA .settings/tile PEK2 STA .settings/tile LDZ2 #0001 ADD2 LDA .settings/tile LDZ2 STA
.settings/tile PEK2 #0002 ADD2 LDA .settings/tile PEK2 #0001 ADD2 STA .settings/tile LDZ2 #0002 ADD2 LDA .settings/tile LDZ2 #0001 ADD2 STA
.settings/tile PEK2 #0003 ADD2 LDA .settings/tile PEK2 #0002 ADD2 STA .settings/tile LDZ2 #0003 ADD2 LDA .settings/tile LDZ2 #0002 ADD2 STA
.settings/tile PEK2 #0004 ADD2 LDA .settings/tile PEK2 #0003 ADD2 STA .settings/tile LDZ2 #0004 ADD2 LDA .settings/tile LDZ2 #0003 ADD2 STA
.settings/tile PEK2 #0005 ADD2 LDA .settings/tile PEK2 #0004 ADD2 STA .settings/tile LDZ2 #0005 ADD2 LDA .settings/tile LDZ2 #0004 ADD2 STA
.settings/tile PEK2 #0006 ADD2 LDA .settings/tile PEK2 #0005 ADD2 STA .settings/tile LDZ2 #0006 ADD2 LDA .settings/tile LDZ2 #0005 ADD2 STA
.settings/tile PEK2 #0007 ADD2 LDA .settings/tile PEK2 #0006 ADD2 STA .settings/tile LDZ2 #0007 ADD2 LDA .settings/tile LDZ2 #0006 ADD2 STA
.settings/tile PEK2 #0007 ADD2 STA .settings/tile LDZ2 #0007 ADD2 STA
RTN RTN
@op_shiftdown ( -- ) @op_shiftdown ( -- )
.settings/tile PEK2 #0007 ADD2 LDA .settings/tile LDZ2 #0007 ADD2 LDA
.settings/tile PEK2 #0006 ADD2 LDA .settings/tile PEK2 #0007 ADD2 STA .settings/tile LDZ2 #0006 ADD2 LDA .settings/tile LDZ2 #0007 ADD2 STA
.settings/tile PEK2 #0005 ADD2 LDA .settings/tile PEK2 #0006 ADD2 STA .settings/tile LDZ2 #0005 ADD2 LDA .settings/tile LDZ2 #0006 ADD2 STA
.settings/tile PEK2 #0004 ADD2 LDA .settings/tile PEK2 #0005 ADD2 STA .settings/tile LDZ2 #0004 ADD2 LDA .settings/tile LDZ2 #0005 ADD2 STA
.settings/tile PEK2 #0003 ADD2 LDA .settings/tile PEK2 #0004 ADD2 STA .settings/tile LDZ2 #0003 ADD2 LDA .settings/tile LDZ2 #0004 ADD2 STA
.settings/tile PEK2 #0002 ADD2 LDA .settings/tile PEK2 #0003 ADD2 STA .settings/tile LDZ2 #0002 ADD2 LDA .settings/tile LDZ2 #0003 ADD2 STA
.settings/tile PEK2 #0001 ADD2 LDA .settings/tile PEK2 #0002 ADD2 STA .settings/tile LDZ2 #0001 ADD2 LDA .settings/tile LDZ2 #0002 ADD2 STA
.settings/tile PEK2 LDA .settings/tile PEK2 #0001 ADD2 STA .settings/tile LDZ2 LDA .settings/tile LDZ2 #0001 ADD2 STA
.settings/tile PEK2 STA .settings/tile LDZ2 STA
RTN RTN
@ -427,42 +427,42 @@ RTN
@draw-bankview ( -- ) @draw-bankview ( -- )
.bankview/x PEK2 #0002 SUB2 .bankview/y PEK2 #0002 SUB2 .bankview/x PEK2 #0081 ADD2 .bankview/y PEK2 #0081 ADD2 #03 ;line-rect JSR2 .bankview/x LDZ2 #0002 SUB2 .bankview/y LDZ2 #0002 SUB2 .bankview/x LDZ2 #0081 ADD2 .bankview/y LDZ2 #0081 ADD2 #03 ;line-rect JSR2
( position ) ( position )
.bankview/x PEK2 .Screen/x DEO2 .bankview/x LDZ2 .Screen/x DEO2
.bankview/y PEK2 #0010 SUB2 .Screen/y DEO2 .bankview/y LDZ2 #0010 SUB2 .Screen/y DEO2
.settings/page PEK2 #22 ;draw-short JSR2 .settings/page LDZ2 #22 ;draw-short JSR2
( toolbar ) ( toolbar )
.bankview/y PEK2 #0010 SUB2 .Screen/y DEO2 .bankview/y LDZ2 #0010 SUB2 .Screen/y DEO2
.bankview/x PEK2 #0028 ADD2 .Screen/x DEO2 .bankview/x LDZ2 #0028 ADD2 .Screen/x DEO2
;depth_icns #00 .settings/depth PEK #0008 MUL2 ADD2 .Screen/addr DEO2 ;depth_icns #00 .settings/depth LDZ #0008 MUL2 ADD2 .Screen/addr DEO2
#23 .Screen/color DEO #23 .Screen/color DEO
.bankview/x PEK2 #0068 ADD2 .Screen/x DEO2 .bankview/x LDZ2 #0068 ADD2 .Screen/x DEO2
;tool_selector .Screen/addr DEO2 ;tool_selector .Screen/addr DEO2
#21 .bankview/mode PEK #00 EQU ADD .Screen/color DEO #21 .bankview/mode LDZ #00 EQU ADD .Screen/color DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
;tool_hand .Screen/addr DEO2 ;tool_hand .Screen/addr DEO2
#21 .bankview/mode PEK #01 EQU ADD .Screen/color DEO #21 .bankview/mode LDZ #01 EQU ADD .Screen/color DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
;tool_eraser .Screen/addr DEO2 ;tool_eraser .Screen/addr DEO2
#21 .bankview/mode PEK #02 EQU ADD .Screen/color DEO #21 .bankview/mode LDZ #02 EQU ADD .Screen/color DEO
( guides ) ( guides )
.bankview/x PEK2 #0010 SUB2 .Screen/x DEO2 .bankview/x LDZ2 #0010 SUB2 .Screen/x DEO2
.bankview/y PEK2 .Screen/y DEO2 .bankview/y LDZ2 .Screen/y DEO2
;font-hex .Screen/addr DEO2 ;font-hex .Screen/addr DEO2
#00 #10 #00 #10
&guides &guides
( draw ) OVR .bankview/selection PEK #04 SFT EQU #22 ADD .Screen/color DEO ( draw ) OVR .bankview/selection LDZ #04 SFT EQU #22 ADD .Screen/color DEO
.Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2 .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2 .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
SWP #01 ADD SWP SWP #01 ADD SWP
@ -471,19 +471,19 @@ RTN
( draw page ) ( draw page )
( load ) .settings/page PEK2 .Screen/addr DEO2 ( load ) .settings/page LDZ2 .Screen/addr DEO2
.bankview/y PEK2 DUP2 #0080 ADD2 .bankview/y LDZ2 DUP2 #0080 ADD2
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
.bankview/x PEK2 DUP2 #0080 ADD2 .bankview/x LDZ2 DUP2 #0080 ADD2
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( get selected ) .Screen/addr DEI2 .settings/tile PEK2 EQU2 ( get selected ) .Screen/addr DEI2 .settings/tile LDZ2 EQU2
( get blending ) .settings/blending PEK ( get blending ) .settings/blending LDZ
( get depth ) .settings/depth PEK #20 MUL ( get depth ) .settings/depth LDZ #20 MUL
( draw ) #20 ADD ADD ADD .Screen/color DEO ( draw ) #20 ADD ADD ADD .Screen/color DEO
( incr ) SWP2 #0008 ADD2 SWP2 ( incr ) SWP2 #0008 ADD2 SWP2
( incr ) .Screen/addr DEI2 #0008 ADD2 #00 .settings/depth PEK #0008 MUL2 ADD2 .Screen/addr DEO2 ( incr ) .Screen/addr DEI2 #0008 ADD2 #00 .settings/depth LDZ #0008 MUL2 ADD2 .Screen/addr DEO2
OVR2 OVR2 LTH2 ,&hor JCN OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2 POP2 POP2
( incr ) SWP2 #0008 ADD2 SWP2 ( incr ) SWP2 #0008 ADD2 SWP2
@ -494,87 +494,87 @@ RTN
@draw-tileview ( -- ) @draw-tileview ( -- )
.tileview/x PEK2 #0002 SUB2 .tileview/y PEK2 #0002 SUB2 .tileview/x PEK2 #0080 ADD2 .tileview/y PEK2 #0081 ADD2 #03 ;line-rect JSR2 .tileview/x LDZ2 #0002 SUB2 .tileview/y LDZ2 #0002 SUB2 .tileview/x LDZ2 #0080 ADD2 .tileview/y LDZ2 #0081 ADD2 #03 ;line-rect JSR2
.tileview/x PEK2 #0028 ADD2 .Screen/x DEO2 .tileview/x LDZ2 #0028 ADD2 .Screen/x DEO2
.tileview/y PEK2 #0010 SUB2 .Screen/y DEO2 .tileview/y LDZ2 #0010 SUB2 .Screen/y DEO2
.settings/tile PEK2 .Screen/addr DEO2 .settings/tile LDZ2 .Screen/addr DEO2
( get blending ) .settings/blending PEK ( get blending ) .settings/blending LDZ
( get depth ) .settings/depth PEK #20 MUL ( get depth ) .settings/depth LDZ #20 MUL
( draw ) #20 ADD ADD .Screen/color DEO ( draw ) #20 ADD ADD .Screen/color DEO
( position ) ( position )
.tileview/x PEK2 .Screen/x DEO2 .tileview/x LDZ2 .Screen/x DEO2
.tileview/y PEK2 #0010 SUB2 .Screen/y DEO2 .tileview/y LDZ2 #0010 SUB2 .Screen/y DEO2
.settings/tile PEK2 #22 ;draw-short JSR2 .settings/tile LDZ2 #22 ;draw-short JSR2
( body ) ( body )
.tileview/x PEK2 .Screen/x DEO2 .tileview/x LDZ2 .Screen/x DEO2
.tileview/y PEK2 .Screen/y DEO2 .tileview/y LDZ2 .Screen/y DEO2
.settings/tile PEK2 .settings/tile POK2 .settings/tile LDZ2 .settings/tile STZ2
;draw-tileview-icn JSR2 ;draw-tileview-icn JSR2
.tileview/x PEK2 #0040 ADD2 .Screen/x DEO2 .tileview/x LDZ2 #0040 ADD2 .Screen/x DEO2
.tileview/y PEK2 .Screen/y DEO2 .tileview/y LDZ2 .Screen/y DEO2
.settings/tile PEK2 #0008 ADD2 .settings/tile POK2 .settings/tile LDZ2 #0008 ADD2 .settings/tile STZ2
;draw-tileview-icn JSR2 ;draw-tileview-icn JSR2
.tileview/x PEK2 .Screen/x DEO2 .tileview/x LDZ2 .Screen/x DEO2
.tileview/y PEK2 #0040 ADD2 .Screen/y DEO2 .tileview/y LDZ2 #0040 ADD2 .Screen/y DEO2
.settings/tile PEK2 #0008 ADD2 .settings/tile POK2 .settings/tile LDZ2 #0008 ADD2 .settings/tile STZ2
;draw-tileview-icn JSR2 ;draw-tileview-icn JSR2
.tileview/x PEK2 #0040 ADD2 .Screen/x DEO2 .tileview/x LDZ2 #0040 ADD2 .Screen/x DEO2
.tileview/y PEK2 #0040 ADD2 .Screen/y DEO2 .tileview/y LDZ2 #0040 ADD2 .Screen/y DEO2
.settings/tile PEK2 #0008 ADD2 .settings/tile POK2 .settings/tile LDZ2 #0008 ADD2 .settings/tile STZ2
;draw-tileview-icn JSR2 ;draw-tileview-icn JSR2
( line hor ) ( line hor )
.tileview/y PEK2 #003f ADD2 .Screen/y DEO2 .tileview/y LDZ2 #003f ADD2 .Screen/y DEO2
.tileview/x PEK2 .Screen/x DEO2 .tileview/x LDZ2 .Screen/x DEO2
&line-hor &line-hor
( draw ) #03 .Screen/color DEO ( draw ) #03 .Screen/color DEO
( incr ) .Screen/x DEI2 #0002 ADD2 .Screen/x DEO2 ( incr ) .Screen/x DEI2 #0002 ADD2 .Screen/x DEO2
.Screen/x DEI2 .tileview/x PEK2 #0082 ADD2 LTH2 ,&line-hor JCN .Screen/x DEI2 .tileview/x LDZ2 #0082 ADD2 LTH2 ,&line-hor JCN
( line ver ) ( line ver )
.tileview/y PEK2 .Screen/y DEO2 .tileview/y LDZ2 .Screen/y DEO2
.tileview/x PEK2 #003f ADD2 .Screen/x DEO2 .tileview/x LDZ2 #003f ADD2 .Screen/x DEO2
&line-ver &line-ver
( draw ) #03 .Screen/color DEO ( draw ) #03 .Screen/color DEO
( incr ) .Screen/y DEI2 #0002 ADD2 .Screen/y DEO2 ( incr ) .Screen/y DEI2 #0002 ADD2 .Screen/y DEO2
.Screen/y DEI2 .tileview/y PEK2 #0081 ADD2 LTH2 ,&line-ver JCN .Screen/y DEI2 .tileview/y LDZ2 #0081 ADD2 LTH2 ,&line-ver JCN
( rewind ) .settings/tile PEK2 #0018 SUB2 .settings/tile POK2 ( rewind ) .settings/tile LDZ2 #0018 SUB2 .settings/tile STZ2
RTN RTN
@draw-editview ( -- ) @draw-editview ( -- )
.editview/x1 PEK2 #0002 SUB2 .editview/y1 PEK2 #0002 SUB2 .editview/x2 PEK2 #0001 ADD2 .editview/y2 PEK2 #0001 ADD2 #03 ;line-rect JSR2 .editview/x1 LDZ2 #0002 SUB2 .editview/y1 LDZ2 #0002 SUB2 .editview/x2 LDZ2 #0001 ADD2 .editview/y2 LDZ2 #0001 ADD2 #03 ;line-rect JSR2
( position ) ( position )
.editview/x1 PEK2 .Screen/x DEO2 .editview/x1 LDZ2 .Screen/x DEO2
.editview/y1 PEK2 #0010 SUB2 .Screen/y DEO2 .editview/y1 LDZ2 #0010 SUB2 .Screen/y DEO2
.settings/tile PEK2 #22 ;draw-short JSR2 .settings/tile LDZ2 #22 ;draw-short JSR2
( tiles ) ( tiles )
.settings/tile PEK2 DUP2 STH2 .Screen/addr DEO2 .settings/tile LDZ2 DUP2 STH2 .Screen/addr DEO2
#00 #04 #00 #04
&ver &ver
OVR #08 MUL TOS #0004 MUL2 .editview/y1 PEK2 ADD2 .Screen/y DEO2 OVR #08 MUL TOS #0004 MUL2 .editview/y1 LDZ2 ADD2 .Screen/y DEO2
#00 #04 #00 #04
&hor &hor
OVR #08 MUL TOS #0004 MUL2 .editview/x1 PEK2 ADD2 .Screen/x DEO2 OVR #08 MUL TOS #0004 MUL2 .editview/x1 LDZ2 ADD2 .Screen/x DEO2
( get x,y ) ( get x,y )
SWP2 OVR STH SWP2 OVR STHr SWP2 OVR STH SWP2 OVR STHr
( check if within ratio ) ( check if within ratio )
.settings/ratio PEK #0f AND LTH STH .settings/ratio LDZ #0f AND LTH STH
.settings/ratio PEK #04 SFT LTH STHr .settings/ratio LDZ #04 SFT LTH STHr
#0101 NEQ2 ,&outside JCN #0101 NEQ2 ,&outside JCN
( get tile ) DUP2r STH2r .Screen/addr DEO2 ( get tile ) DUP2r STH2r .Screen/addr DEO2
@ -598,12 +598,12 @@ RTN
POP2r POP2r
( grid ) ( grid )
.editview/x1 PEK2 DUP2 #0080 ADD2 .editview/y1 PEK2 #0020 ADD2 #03 ;line-hor JSR2 .editview/x1 LDZ2 DUP2 #0080 ADD2 .editview/y1 LDZ2 #0020 ADD2 #03 ;line-hor JSR2
.editview/x1 PEK2 DUP2 #0080 ADD2 .editview/y1 PEK2 #0040 ADD2 #03 ;line-hor JSR2 .editview/x1 LDZ2 DUP2 #0080 ADD2 .editview/y1 LDZ2 #0040 ADD2 #03 ;line-hor JSR2
.editview/x1 PEK2 DUP2 #0080 ADD2 .editview/y1 PEK2 #0060 ADD2 #03 ;line-hor JSR2 .editview/x1 LDZ2 DUP2 #0080 ADD2 .editview/y1 LDZ2 #0060 ADD2 #03 ;line-hor JSR2
.editview/x1 PEK2 #0020 ADD2 .editview/y1 PEK2 DUP2 #0080 ADD2 #03 ;line-ver JSR2 .editview/x1 LDZ2 #0020 ADD2 .editview/y1 LDZ2 DUP2 #0080 ADD2 #03 ;line-ver JSR2
.editview/x1 PEK2 #0040 ADD2 .editview/y1 PEK2 DUP2 #0080 ADD2 #03 ;line-ver JSR2 .editview/x1 LDZ2 #0040 ADD2 .editview/y1 LDZ2 DUP2 #0080 ADD2 #03 ;line-ver JSR2
.editview/x1 PEK2 #0060 ADD2 .editview/y1 PEK2 DUP2 #0080 ADD2 #03 ;line-ver JSR2 .editview/x1 LDZ2 #0060 ADD2 .editview/y1 LDZ2 DUP2 #0080 ADD2 #03 ;line-ver JSR2
RTN RTN
@ -651,44 +651,44 @@ RTN
@draw-tileview-icn ( -- ) @draw-tileview-icn ( -- )
#00 .pt/x POK #00 .pt/y POK #00 .pt/x STZ #00 .pt/y STZ
&ver &ver
#00 .pt/x POK #00 .pt/x STZ
&hor &hor
( get bit ) ( get bit )
;blank_icn #00 ;blank_icn #00
.settings/tile PEK2 #00 .pt/y PEK ADD2 LDA #07 .pt/x PEK SUB SFT #01 AND ( get bit ) .settings/tile LDZ2 #00 .pt/y LDZ ADD2 LDA #07 .pt/x LDZ SUB SFT #01 AND ( get bit )
#0008 MUL2 ADD2 .Screen/addr DEO2 ( add *8 ) #0008 MUL2 ADD2 .Screen/addr DEO2 ( add *8 )
( draw ) #21 .Screen/color DEO ( draw ) #21 .Screen/color DEO
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
( incr ) .pt/x PEK #01 ADD .pt/x POK ( incr ) .pt/x LDZ #01 ADD .pt/x STZ
.pt/x PEK #08 LTH ;&hor JCN2 .pt/x LDZ #08 LTH ;&hor JCN2
( incr ) .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2 ( incr ) .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
( incr ) .pt/y PEK #01 ADD .pt/y POK ( incr ) .pt/y LDZ #01 ADD .pt/y STZ
.Screen/x DEI2 #0040 SUB2 .Screen/x DEO2 .Screen/x DEI2 #0040 SUB2 .Screen/x DEO2
.pt/y PEK #08 LTH ;&ver JCN2 .pt/y LDZ #08 LTH ;&ver JCN2
RTN RTN
@draw-blendview ( -- ) @draw-blendview ( -- )
( .blendview/x1 PEK2 #0002 SUB2 .blendview/y1 PEK2 #0002 SUB2 .blendview/x2 PEK2 #0001 ADD2 .blendview/y2 PEK2 #0001 ADD2 #03 ;line-rect JSR2 ) ( .blendview/x1 LDZ2 #0002 SUB2 .blendview/y1 LDZ2 #0002 SUB2 .blendview/x2 LDZ2 #0001 ADD2 .blendview/y2 LDZ2 #0001 ADD2 #03 ;line-rect JSR2 )
.settings/tile PEK2 .Screen/addr DEO2 .settings/tile LDZ2 .Screen/addr DEO2
#00 #10 #00 #10
&loop &loop
OVR #04 MOD #00 SWP #0008 MUL2 .blendview/x1 PEK2 ADD2 .Screen/x DEO2 OVR #04 MOD #00 SWP #0008 MUL2 .blendview/x1 LDZ2 ADD2 .Screen/x DEO2
OVR #04 DIV #00 SWP #0008 MUL2 .blendview/y1 PEK2 ADD2 .Screen/y DEO2 OVR #04 DIV #00 SWP #0008 MUL2 .blendview/y1 LDZ2 ADD2 .Screen/y DEO2
#20 .Screen/color DEO #20 .Screen/color DEO
OVR #20 ADD .settings/depth PEK #20 MUL ADD .Screen/color DEO OVR #20 ADD .settings/depth LDZ #20 MUL ADD .Screen/color DEO
SWP #01 ADD SWP SWP #01 ADD SWP
DUP2 LTH ,&loop JCN DUP2 LTH ,&loop JCN
POP2 POP2
.blendview/x1 PEK2 .Screen/x DEO2 .blendview/x1 LDZ2 .Screen/x DEO2
.blendview/y2 PEK2 #0001 ADD2 .Screen/y DEO2 .blendview/y2 LDZ2 #0001 ADD2 .Screen/y DEO2
( get blending ) .settings/blending PEK ( get blending ) .settings/blending LDZ
( get depth ) .settings/depth PEK #20 MUL ( get depth ) .settings/depth LDZ #20 MUL
( draw ) #20 ADD ADD #21 ;draw-byte JSR2 ( draw ) #20 ADD ADD #21 ;draw-byte JSR2
RTN RTN
@ -697,14 +697,14 @@ RTN
( bytes ) ( bytes )
.tileview/y PEK2 #0018 ADD2 .Screen/y DEO2 .tileview/y LDZ2 #0018 ADD2 .Screen/y DEO2
#00 .i POK #00 .i STZ
&bytes &bytes
.tileview/x PEK2 #0088 ADD2 .Screen/x DEO2 .tileview/x LDZ2 #0088 ADD2 .Screen/x DEO2
.settings/tile PEK2 #00 .i PEK ADD2 LDA #22 ;draw-byte JSR2 .settings/tile LDZ2 #00 .i LDZ ADD2 LDA #22 ;draw-byte JSR2
( incr ) .i PEK #01 ADD .i POK ( incr ) .i LDZ #01 ADD .i STZ
( incr ) .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2 ( incr ) .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
.i PEK #08 LTH ;&bytes JCN2 .i LDZ #08 LTH ;&bytes JCN2
( operations ) ( operations )
@ -716,43 +716,43 @@ RTN
#21 .Screen/color DEO #21 .Screen/color DEO
( draw tiles 2x2 ) ( draw tiles 2x2 )
.tileview/y PEK2 .Screen/y DEO2 .tileview/y LDZ2 .Screen/y DEO2
#00 .pt/x POK #00 .pt/y POK .settings/tile PEK2 .Screen/addr DEO2 #00 .pt/x STZ #00 .pt/y STZ .settings/tile LDZ2 .Screen/addr DEO2
&tiles-ver &tiles-ver
#00 .pt/x POK #00 .pt/x STZ
.tileview/x PEK2 #0088 ADD2 .Screen/x DEO2 .tileview/x LDZ2 #0088 ADD2 .Screen/x DEO2
&tiles-hor &tiles-hor
( draw ) #23 .Screen/color DEO ( draw ) #23 .Screen/color DEO
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
( incr ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2 ( incr ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2
( incr ) .pt/x PEK #01 ADD .pt/x POK ( incr ) .pt/x LDZ #01 ADD .pt/x STZ
.pt/x PEK #02 LTH ;&tiles-hor JCN2 .pt/x LDZ #02 LTH ;&tiles-hor JCN2
( incr ) .pt/y PEK #01 ADD .pt/y POK ( incr ) .pt/y LDZ #01 ADD .pt/y STZ
( incr ) .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2 ( incr ) .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
.pt/y PEK #02 LTH ;&tiles-ver JCN2 .pt/y LDZ #02 LTH ;&tiles-ver JCN2
RTN RTN
@draw-colorview ( -- ) @draw-colorview ( -- )
.colorview/y1 PEK2 #18 ADD .Screen/y DEO2 .colorview/y1 LDZ2 #18 ADD .Screen/y DEO2
.colorview/x1 PEK2 #08 ADD .Screen/x DEO2 .colorview/x1 LDZ2 #08 ADD .Screen/x DEO2
.System/r DEI2 ;draw-color-code JSR2 .System/r DEI2 ;draw-color-code JSR2
.colorview/y1 PEK2 #18 ADD .Screen/y DEO2 .colorview/y1 LDZ2 #18 ADD .Screen/y DEO2
.colorview/x1 PEK2 #10 ADD .Screen/x DEO2 .colorview/x1 LDZ2 #10 ADD .Screen/x DEO2
.System/g DEI2 ;draw-color-code JSR2 .System/g DEI2 ;draw-color-code JSR2
.colorview/y1 PEK2 #18 ADD .Screen/y DEO2 .colorview/y1 LDZ2 #18 ADD .Screen/y DEO2
.colorview/x1 PEK2 #18 ADD .Screen/x DEO2 .colorview/x1 LDZ2 #18 ADD .Screen/x DEO2
.System/b DEI2 ;draw-color-code JSR2 .System/b DEI2 ;draw-color-code JSR2
.colorview/x1 PEK2 .Screen/x DEO2 .colorview/x1 LDZ2 .Screen/x DEO2
;circle_icns .Screen/addr DEO2 ;circle_icns .Screen/addr DEO2
#00 #04 #00 #04
&loop &loop
OVR .settings/brush PEK EQU #00 SWP #0008 MUL2 ;circle_icns ADD2 .Screen/addr DEO2 OVR .settings/brush LDZ EQU #00 SWP #0008 MUL2 ;circle_icns ADD2 .Screen/addr DEO2
OVR .colorview/y1 PEK2 ROT #00 SWP #0008 MUL2 ADD2 .Screen/y DEO2 OVR .colorview/y1 LDZ2 ROT #00 SWP #0008 MUL2 ADD2 .Screen/y DEO2
OVR #20 ADD .Screen/color DEO OVR #20 ADD .Screen/color DEO
SWP #01 ADD SWP SWP #01 ADD SWP
DUP2 LTH ,&loop JCN DUP2 LTH ,&loop JCN
@ -763,24 +763,24 @@ RTN
@draw-preview ( -- ) @draw-preview ( -- )
( stash address ) ( stash address )
.settings/tile PEK2 DUP2 STH2 .Screen/addr DEO2 .settings/tile LDZ2 DUP2 STH2 .Screen/addr DEO2
#00 #04 #00 #04
&ver &ver
OVR #08 MUL TOS .preview/y1 PEK2 ADD2 .Screen/y DEO2 OVR #08 MUL TOS .preview/y1 LDZ2 ADD2 .Screen/y DEO2
#00 #04 #00 #04
&hor &hor
OVR #08 MUL TOS .preview/x1 PEK2 ADD2 .Screen/x DEO2 OVR #08 MUL TOS .preview/x1 LDZ2 ADD2 .Screen/x DEO2
( get x,y ) ( get x,y )
SWP2 OVR STH SWP2 OVR STHr SWP2 OVR STH SWP2 OVR STHr
( check if within ratio ) ( check if within ratio )
.settings/ratio PEK #0f AND LTH STH .settings/ratio LDZ #0f AND LTH STH
.settings/ratio PEK #04 SFT LTH STHr .settings/ratio LDZ #04 SFT LTH STHr
#0101 NEQ2 ,&outside JCN #0101 NEQ2 ,&outside JCN
( get tile ) DUP2r STH2r .Screen/addr DEO2 ( get tile ) DUP2r STH2r .Screen/addr DEO2
( get blending ) .settings/blending PEK ( get blending ) .settings/blending LDZ
( get depth ) .settings/depth PEK #20 MUL ( get depth ) .settings/depth LDZ #20 MUL
( draw ) #20 ADD ADD .Screen/color DEO ( draw ) #20 ADD ADD .Screen/color DEO
( incr ) STH2r #0008 [ .settings/depth PEK #08 MUL TOS ADD2 ] ADD2 STH2 ( incr ) STH2r #0008 [ .settings/depth LDZ #08 MUL TOS ADD2 ] ADD2 STH2
,&resume JMP ,&resume JMP
&outside &outside
;halftone_icn .Screen/addr DEO2 ;halftone_icn .Screen/addr DEO2
@ -793,9 +793,9 @@ RTN
DUP2 LTH ;&ver JCN2 DUP2 LTH ;&ver JCN2
POP2 POP2
POP2r POP2r
.preview/x1 PEK2 #0001 SUB2 .Screen/x DEO2 .preview/x1 LDZ2 #0001 SUB2 .Screen/x DEO2
.preview/y2 PEK2 #0001 ADD2 .Screen/y DEO2 .preview/y2 LDZ2 #0001 ADD2 .Screen/y DEO2
.settings/ratio PEK #23 ;draw-byte JSR2 .settings/ratio LDZ #23 ;draw-byte JSR2
RTN RTN
@ -803,13 +803,13 @@ RTN
DUP ;font-hex ROT #0f AND #08 MUL #00 SWP ADD2 .Screen/addr DEO2 DUP ;font-hex ROT #0f AND #08 MUL #00 SWP ADD2 .Screen/addr DEO2
( draw ) #22 .Screen/color DEO ( draw ) #22 .Screen/color DEO
.colorview/y1 PEK2 #10 ADD .Screen/y DEO2 .colorview/y1 LDZ2 #10 ADD .Screen/y DEO2
;font-hex ROT #04 SFT #08 MUL #00 SWP ADD2 .Screen/addr DEO2 ;font-hex ROT #04 SFT #08 MUL #00 SWP ADD2 .Screen/addr DEO2
( draw ) #22 .Screen/color DEO ( draw ) #22 .Screen/color DEO
.colorview/y1 PEK2 #08 ADD .Screen/y DEO2 .colorview/y1 LDZ2 #08 ADD .Screen/y DEO2
DUP ;font-hex ROT #0f AND #08 MUL #00 SWP ADD2 .Screen/addr DEO2 DUP ;font-hex ROT #0f AND #08 MUL #00 SWP ADD2 .Screen/addr DEO2
( draw ) #22 .Screen/color DEO ( draw ) #22 .Screen/color DEO
.colorview/y1 PEK2 .Screen/y DEO2 .colorview/y1 LDZ2 .Screen/y DEO2
;font-hex ROT #04 SFT #08 MUL #00 SWP ADD2 .Screen/addr DEO2 ;font-hex ROT #04 SFT #08 MUL #00 SWP ADD2 .Screen/addr DEO2
( draw ) #22 .Screen/color DEO ( draw ) #22 .Screen/color DEO
@ -818,30 +818,30 @@ RTN
@draw-cursor ( -- ) @draw-cursor ( -- )
( clear last cursor ) ( clear last cursor )
.mouse/x PEK2 .Screen/x DEO2 .mouse/x LDZ2 .Screen/x DEO2
.mouse/y PEK2 .Screen/y DEO2 .mouse/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record mouse positions ) ( record mouse positions )
.Mouse/x DEI2 .mouse/x POK2 .Mouse/x DEI2 .mouse/x STZ2
.Mouse/y DEI2 .mouse/y POK2 .Mouse/y DEI2 .mouse/y STZ2
( draw new cursor ) ( draw new cursor )
.mouse/x PEK2 .Screen/x DEO2 .mouse/x LDZ2 .Screen/x DEO2
.mouse/y PEK2 .Screen/y DEO2 .mouse/y LDZ2 .Screen/y DEO2
;tool_selector #00 .bankview/mode PEK #08 MUL ADD2 .Screen/addr DEO2 ;tool_selector #00 .bankview/mode LDZ #08 MUL ADD2 .Screen/addr DEO2
#32 .Mouse/state DEI #00 NEQ ADD .Screen/color DEO #32 .Mouse/state DEI #00 NEQ ADD .Screen/color DEO
RTN RTN
@draw-byte ( byte color -- ) @draw-byte ( byte color -- )
.color POK STH .color STZ STH
;font-hex #00 DUPr STHr #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2 ;font-hex #00 DUPr STHr #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
;font-hex #00 STHr #0f AND #08 MUL ADD2 .Screen/addr DEO2 ;font-hex #00 STHr #0f AND #08 MUL ADD2 .Screen/addr DEO2
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
RTN RTN
@ -866,20 +866,20 @@ RTN
@line-rect ( x1* y1* x2* y2* color -- ) @line-rect ( x1* y1* x2* y2* color -- )
( load ) .color POK DUP2 STH2 .rect/y2 POK2 .rect/x2 POK2 DUP2 STH2 .rect/y1 POK2 .rect/x1 POK2 ( load ) .color STZ DUP2 STH2 .rect/y2 STZ2 .rect/x2 STZ2 DUP2 STH2 .rect/y1 STZ2 .rect/x1 STZ2
STH2r STH2r STH2r STH2r
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK DUP .Screen/color DEO ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .Screen/color DEO ( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/color DEO
( incr ) SWP2 #0001 ADD2 SWP2 ( incr ) SWP2 #0001 ADD2 SWP2
OVR2 OVR2 LTS2 ,&ver JCN OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2 POP2 POP2
.rect/x1 PEK2 .rect/x2 PEK2 .rect/x1 LDZ2 .rect/x2 LDZ2
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK DUP .Screen/color DEO ( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .Screen/color DEO ( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/color DEO
( incr ) SWP2 #0001 ADD2 SWP2 ( incr ) SWP2 #0001 ADD2 SWP2
OVR2 OVR2 #0001 ADD2 LTS2 ,&hor JCN OVR2 OVR2 #0001 ADD2 LTS2 ,&hor JCN
POP2 POP2 POP2 POP2

View File

@ -32,55 +32,55 @@
( theme ) #03fd .System/r DEO2 #0ef3 .System/g DEO2 #0bf2 .System/b DEO2 ( theme ) #03fd .System/r DEO2 #0ef3 .System/g DEO2 #0bf2 .System/b DEO2
( vectors ) ;on-screen .Screen/vector DEO2 ( vectors ) ;on-screen .Screen/vector DEO2
#01 .fps/current POK #01 .fps/current STZ
#000c #000c
DUP2 .lines/x1 POK2 DUP2 .lines/x1 STZ2
DUP2 .lines/y1 POK2 DUP2 .lines/y1 STZ2
DUP2 .Screen/width DEI2 SWP2 SUB2 #0001 SUB2 .lines/x2 POK2 DUP2 .Screen/width DEI2 SWP2 SUB2 #0001 SUB2 .lines/x2 STZ2
.Screen/height DEI2 SWP2 SUB2 .lines/y2 POK2 .Screen/height DEI2 SWP2 SUB2 .lines/y2 STZ2
#02 .neralie/color POK #02 .neralie/color STZ
.lines/x1 PEK2 .lines/x2 PEK2 .lines/x1 LDZ2 .lines/x2 LDZ2
OVR2 OVR2 .lines/y1 PEK2 ;h JSR2 OVR2 OVR2 .lines/y1 LDZ2 ;h JSR2
.lines/y2 PEK2 ;h JSR2 .lines/y2 LDZ2 ;h JSR2
.lines/y1 PEK2 #0001 SUB2 .lines/y2 PEK2 #0001 ADD2 .lines/y1 LDZ2 #0001 SUB2 .lines/y2 LDZ2 #0001 ADD2
OVR2 OVR2 .lines/x1 PEK2 ;v JSR2 OVR2 OVR2 .lines/x1 LDZ2 ;v JSR2
.lines/x2 PEK2 ;v JSR2 .lines/x2 LDZ2 ;v JSR2
@on-screen @on-screen
;update-fps JSR2 ;update-fps JSR2
#00 .neralie/color POK #00 .neralie/color STZ
;neralie-lines JSR2 ;neralie-lines JSR2
;neralie-calc JSR2 ;neralie-calc JSR2
#02 .neralie/color POK #02 .neralie/color STZ
;arvelie-text JSR2 ;arvelie-text JSR2
;neralie-text JSR2 ;neralie-text JSR2
;neralie-lines JSR2 ;neralie-lines JSR2
BRK BRK
#22 .Screen/color DEO #22 .Screen/color DEO
#0000 #00 .number/count PEK DUP2 ;h JSR2 #0000 #00 .number/count LDZ DUP2 ;h JSR2
.number/count PEK #01 ADD .number/count POK .number/count LDZ #01 ADD .number/count STZ
@neralie-calc ( -- ) @neralie-calc ( -- )
( add up fractions of a pulse, store tenths in n6 ) ( add up fractions of a pulse, store tenths in n6 )
#0120 #00 h MUL2 #0120 #00 h MUL2
#00c0 #00 m MUL2 ADD2 #00c0 #00 m MUL2 ADD2
#00f8 #00 s MUL2 ADD2 #00f8 #00 s MUL2 ADD2
#0271 #00 .fps/next PEK MUL2 #00 .fps/current PEK DIV2 #0008 MUL2 ADD2 #0271 #00 .fps/next LDZ MUL2 #00 .fps/current LDZ DIV2 #0008 MUL2 ADD2
#01b0 ;modf JSR2 SWP2 #0017 MUL2 #03e8 DIV2 .neralie/n6 POK POP #01b0 ;modf JSR2 SWP2 #0017 MUL2 #03e8 DIV2 .neralie/n6 STZ POP
( add up units and tens of pulses, store in n5 and n4 ) ( add up units and tens of pulses, store in n5 and n4 )
#0042 #00 h MUL2 ADD2 #0042 #00 h MUL2 ADD2
#005e #00 m MUL2 ADD2 #005e #00 m MUL2 ADD2
#000b #00 s MUL2 ADD2 #000b #00 s MUL2 ADD2
#000a ;modf JSR2 SWP2 .neralie/n5 POK POP #000a ;modf JSR2 SWP2 .neralie/n5 STZ POP
#000a ;modf JSR2 SWP2 .neralie/n4 POK POP #000a ;modf JSR2 SWP2 .neralie/n4 STZ POP
( add up hundreds of pulses + 10 x beats, store in n0123 ) ( add up hundreds of pulses + 10 x beats, store in n0123 )
#01a0 #00 h MUL2 ADD2 #01a0 #00 h MUL2 ADD2
#0006 #00 m MUL2 ADD2 .neralie/n0123 POK2 #0006 #00 m MUL2 ADD2 .neralie/n0123 STZ2
JMP2r JMP2r
@ -98,14 +98,14 @@
@neralie-text ( -- ) @neralie-text ( -- )
.Screen/width DEI2 #0002 DIV2 #0004 SUB2 .Screen/x DEO2 .Screen/width DEI2 #0002 DIV2 #0004 SUB2 .Screen/x DEO2
.neralie/n0123 PEK2 .neralie/n0123 LDZ2
#03e8 ;modf JSR2 ,digit JSR #03e8 ;modf JSR2 ,digit JSR
#0064 ;modf JSR2 ,digit JSR #0064 ;modf JSR2 ,digit JSR
#000a ;modf JSR2 ,digit JSR #000a ;modf JSR2 ,digit JSR
#000b ,digit JSR ( the colon ) #000b ,digit JSR ( the colon )
,digit JSR ,digit JSR
#00 .neralie/n4 PEK ,digit JSR #00 .neralie/n4 LDZ ,digit JSR
#00 .neralie/n5 PEK ,digit JSR #00 .neralie/n5 LDZ ,digit JSR
JMP2r JMP2r
@letter ( index* -- ) @letter ( index* -- )
@ -115,24 +115,24 @@
@digit ( index* -- ) @digit ( index* -- )
#0008 MUL2 ;font-numbers ADD2 .Screen/addr DEO2 #0008 MUL2 ;font-numbers ADD2 .Screen/addr DEO2
&middle &middle
.neralie/color PEK #20 ADD .Screen/color DEO .neralie/color LDZ #20 ADD .Screen/color DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
JMP2r JMP2r
@neralie-lines ( -- ) @neralie-lines ( -- )
.lines/x2 PEK2 .lines/x1 PEK2 DUP2 .neralie/x POK2 SUB2 .neralie/w POK2 .lines/x2 LDZ2 .lines/x1 LDZ2 DUP2 .neralie/x STZ2 SUB2 .neralie/w STZ2
.lines/y2 PEK2 .lines/y1 PEK2 DUP2 .neralie/y POK2 SUB2 .neralie/h POK2 .lines/y2 LDZ2 .lines/y1 LDZ2 DUP2 .neralie/y STZ2 SUB2 .neralie/h STZ2
;neralie/n4 SWP POP .neralie/n0123 PEK2 ;neralie/n4 SWP POP .neralie/n0123 LDZ2
DUP2 ;&h JSR2 DUP2 ;&h JSR2
;&next JSR2 #0001 .Screen/x DEO2 .neralie/y PEK2 #0003 SUB2 .Screen/y DEO2 ,digit JSR ;&next JSR2 #0001 .Screen/x DEO2 .neralie/y LDZ2 #0003 SUB2 .Screen/y DEO2 ,digit JSR
DUP2 ;&v JSR2 DUP2 ;&v JSR2
#04 ;v/spacing STA #04 ;v/spacing STA
.lines/y1 PEK2 #0003 SUB2 .neralie/y PEK2 .neralie/x PEK2 ;v JSR2 .lines/y1 LDZ2 #0003 SUB2 .neralie/y LDZ2 .neralie/x LDZ2 ;v JSR2
#01 ;v/spacing STA #01 ;v/spacing STA
,&next JSR #0001 .Screen/y DEO2 .neralie/x PEK2 #0003 SUB2 .Screen/x DEO2 ;digit JSR2 ,&next JSR #0001 .Screen/y DEO2 .neralie/x LDZ2 #0003 SUB2 .Screen/x DEO2 ;digit JSR2
DUP2 ,&h JSR DUP2 ,&h JSR
,&next JSR .Screen/width DEI2 #0009 SUB2 .Screen/x DEO2 .neralie/y PEK2 #0003 SUB2 .Screen/y DEO2 ;digit JSR2 ,&next JSR .Screen/width DEI2 #0009 SUB2 .Screen/x DEO2 .neralie/y LDZ2 #0003 SUB2 .Screen/y DEO2 ;digit JSR2
DUP2 ,&v JSR DUP2 ,&v JSR
,&next JSR POP2 ,&next JSR POP2
DUP2 ,&h JSR DUP2 ,&h JSR
@ -144,25 +144,25 @@
&next ( digit-addr number* -- next-digit-addr next-number* prev-digit* ) &next ( digit-addr number* -- next-digit-addr next-number* prev-digit* )
#03e8 ;modf JSR2 STH2 #000a MUL2 #03e8 ;modf JSR2 STH2 #000a MUL2
ROT DUP STH #01 ADD ROT ROT ROT DUP STH #01 ADD ROT ROT
#00 STHr PEK ADD2 #00 STHr LDZ ADD2
STH2r STH2r
JMP2r JMP2r
&h ( number* -- ) &h ( number* -- )
,scale JSR ,scale JSR
.neralie/h PEK2 ;mul2hi JSR2 .neralie/h LDZ2 ;mul2hi JSR2
DUP2 #0000 NEQ2 #02 JCN POP2 JMP2r DUP2 #0000 NEQ2 #02 JCN POP2 JMP2r
DUP2 .neralie/y PEK2 ADD2 .neralie/y POK2 DUP2 .neralie/y LDZ2 ADD2 .neralie/y STZ2
.neralie/h PEK2 SWP2 SUB2 .neralie/h POK2 .neralie/h LDZ2 SWP2 SUB2 .neralie/h STZ2
.neralie/x PEK2 DUP2 .neralie/w PEK2 ADD2 .neralie/y PEK2 ,h JMP .neralie/x LDZ2 DUP2 .neralie/w LDZ2 ADD2 .neralie/y LDZ2 ,h JMP
&v ( number* -- ) &v ( number* -- )
,scale JSR ,scale JSR
.neralie/w PEK2 ;mul2hi JSR2 .neralie/w LDZ2 ;mul2hi JSR2
DUP2 #0000 NEQ2 #02 JCN POP2 JMP2r DUP2 #0000 NEQ2 #02 JCN POP2 JMP2r
DUP2 .neralie/x PEK2 ADD2 .neralie/x POK2 DUP2 .neralie/x LDZ2 ADD2 .neralie/x STZ2
.neralie/w PEK2 SWP2 SUB2 .neralie/w POK2 .neralie/w LDZ2 SWP2 SUB2 .neralie/w STZ2
.neralie/y PEK2 DUP2 .neralie/h PEK2 ADD2 .neralie/x PEK2 ,v JMP .neralie/y LDZ2 DUP2 .neralie/h LDZ2 ADD2 .neralie/x LDZ2 ,v JMP
@scale ( 0..10000* -- 0..65535* ) @scale ( 0..10000* -- 0..65535* )
DUP2 #8db8 ;mul2hi JSR2 DUP2 #8db8 ;mul2hi JSR2
@ -171,12 +171,12 @@
@h ( x1* x2* y* -- ) @h ( x1* x2* y* -- )
.Screen/y DEO2 .Screen/y DEO2
.Screen/x .lines/addr POK .Screen/x .lines/addr STZ
,v/draw-line JMP ,v/draw-line JMP
@v ( y1* y2* x* -- ) @v ( y1* y2* x* -- )
.Screen/x DEO2 .Screen/x DEO2
.Screen/y .lines/addr POK .Screen/y .lines/addr STZ
&draw-line ( v1* v2* -- ) &draw-line ( v1* v2* -- )
OVR2 OVR2 LTH2 #01 JCN SWP2 OVR2 OVR2 LTH2 #01 JCN SWP2
@ -189,20 +189,20 @@
JMP2r JMP2r
&keep-going &keep-going
DUP2 .lines/addr PEK DEO2 DUP2 .lines/addr LDZ DEO2
.neralie/color PEK .Screen/color DEO .neralie/color LDZ .Screen/color DEO
,&loop JMP ,&loop JMP
@update-fps ( -- ) @update-fps ( -- )
.fps/next PEK #01 ADD .fps/next POK .fps/next LDZ #01 ADD .fps/next STZ
s .fps/second PEK NEQ JMP JMP2r s .fps/second LDZ NEQ JMP JMP2r
s .fps/second POK s .fps/second STZ
.fps/next PEK .fps/current POK .fps/next LDZ .fps/current STZ
( ~fps.next ^print-byte-decimal JSR ( ~fps.next ^print-byte-decimal JSR
,strings-fps ^print-string JSR ) ,strings-fps ^print-string JSR )
#00 .fps/next POK #00 .fps/next STZ
JMP2r JMP2r
@modf ( dividend* divisor* -- remainder* quotient* ) @modf ( dividend* divisor* -- remainder* quotient* )
@ -229,12 +229,12 @@
;mul/bhi STA2 ;mul/ahi STA2 ;mul/bhi STA2 ;mul/ahi STA2
#00 #00
#00 #00
#00 .mul/alo PEK #00 .mul/blo PEK MUL2 #00 .mul/alo LDZ #00 .mul/blo LDZ MUL2
POP POP
#00 .mul/ahi PEK #00 .mul/blo PEK MUL2 ,&adc JSR #00 .mul/ahi LDZ #00 .mul/blo LDZ MUL2 ,&adc JSR
#00 .mul/alo PEK #00 .mul/bhi PEK MUL2 ,&adc JSR #00 .mul/alo LDZ #00 .mul/bhi LDZ MUL2 ,&adc JSR
POP POP
#00 .mul/ahi PEK #00 .mul/bhi PEK MUL2 ADD2 #00 .mul/ahi LDZ #00 .mul/bhi LDZ MUL2 ADD2
JMP2r JMP2r
&adc ( 31..24 a* b* -- 31..24 sum* ) &adc ( 31..24 a* b* -- 31..24 sum* )

View File

@ -25,7 +25,7 @@
%2/ { #0001 SFT2 } %2/ { #0001 SFT2 }
%8/ { #0003 SFT2 } %8* { #0030 SFT2 } %8/ { #0003 SFT2 } %8* { #0030 SFT2 }
%8+ { #0008 ADD2 } %8+ { #0008 ADD2 }
%FILESIZE { .canvas/w PEK2 .canvas/h PEK2 MUL2 #0008 MUL2 } %FILESIZE { .canvas/w LDZ2 .canvas/h LDZ2 MUL2 #0008 MUL2 }
( devices ) ( devices )
@ -66,28 +66,28 @@
|0100 |0100
( theme ) ( theme )
#e0fa .theme/r0 POK2 #30fa .theme/g0 POK2 #30fa .theme/b0 POK2 ( normal mode ) #e0fa .theme/r0 STZ2 #30fa .theme/g0 STZ2 #30fa .theme/b0 STZ2 ( normal mode )
#00fe .theme/r1 POK2 #00f3 .theme/g1 POK2 #00f3 .theme/b1 POK2 ( presentation mode ) #00fe .theme/r1 STZ2 #00f3 .theme/g1 STZ2 #00f3 .theme/b1 STZ2 ( presentation mode )
( vectors ) ;on-screen .Screen/vector DEO2 ( vectors ) ;on-screen .Screen/vector DEO2
( vectors ) ;on-button .Controller/vector DEO2 ( vectors ) ;on-button .Controller/vector DEO2
( vectors ) ;on-mouse .Mouse/vector DEO2 ( vectors ) ;on-mouse .Mouse/vector DEO2
.theme/r0 PEK2 .System/r DEO2 .theme/g0 PEK2 .System/g DEO2 .theme/b0 PEK2 .System/b DEO2 .theme/r0 LDZ2 .System/r DEO2 .theme/g0 LDZ2 .System/g DEO2 .theme/b0 LDZ2 .System/b DEO2
( default canvas ) ( default canvas )
#002a .canvas/w POK2 #0018 .canvas/h POK2 #002a .canvas/w STZ2 #0018 .canvas/h STZ2
( default brush ) ( default brush )
#04 .brush/size POK #00 .brush/patt POK #00 .brush/tool POK #04 .brush/size STZ #00 .brush/patt STZ #00 .brush/tool STZ
( load file ) ( load file )
;untitled_txt ;path/name ;strcpy JSR2 ;untitled_txt ;path/name ;strcpy JSR2
( setup panes ) ( setup panes )
#0010 .toolpane/x1 POK2 #0010 .toolpane/y1 POK2 .toolpane/x1 PEK2 #0028 ADD2 .toolpane/x2 POK2 .toolpane/y1 PEK2 #0008 ADD2 .toolpane/y2 POK2 #0010 .toolpane/x1 STZ2 #0010 .toolpane/y1 STZ2 .toolpane/x1 LDZ2 #0028 ADD2 .toolpane/x2 STZ2 .toolpane/y1 LDZ2 #0008 ADD2 .toolpane/y2 STZ2
#0040 .sizepane/x1 POK2 #0010 .sizepane/y1 POK2 .sizepane/x1 PEK2 #0040 ADD2 .sizepane/x2 POK2 .sizepane/y1 PEK2 #0008 ADD2 .sizepane/y2 POK2 #0040 .sizepane/x1 STZ2 #0010 .sizepane/y1 STZ2 .sizepane/x1 LDZ2 #0040 ADD2 .sizepane/x2 STZ2 .sizepane/y1 LDZ2 #0008 ADD2 .sizepane/y2 STZ2
.Screen/width DEI2 #0078 SUB2 .viewpane/x1 POK2 #0010 .viewpane/y1 POK2 .viewpane/x1 PEK2 #0020 ADD2 .viewpane/x2 POK2 .viewpane/y1 PEK2 #0008 ADD2 .viewpane/y2 POK2 .Screen/width DEI2 #0078 SUB2 .viewpane/x1 STZ2 #0010 .viewpane/y1 STZ2 .viewpane/x1 LDZ2 #0020 ADD2 .viewpane/x2 STZ2 .viewpane/y1 LDZ2 #0008 ADD2 .viewpane/y2 STZ2
.Screen/width DEI2 #0050 SUB2 .pattpane/x1 POK2 #0010 .pattpane/y1 POK2 .pattpane/x1 PEK2 #0040 ADD2 .pattpane/x2 POK2 .pattpane/y1 PEK2 #0008 ADD2 .pattpane/y2 POK2 .Screen/width DEI2 #0050 SUB2 .pattpane/x1 STZ2 #0010 .pattpane/y1 STZ2 .pattpane/x1 LDZ2 #0040 ADD2 .pattpane/x2 STZ2 .pattpane/y1 LDZ2 #0008 ADD2 .pattpane/y2 STZ2
( ready. ) ( ready. )
;center JSR2 ;center JSR2
@ -100,15 +100,15 @@ BRK
@on-screen ( -> ) @on-screen ( -> )
.document/edit PEK #01 NEQ ,&no-edit JCN .document/edit LDZ #01 NEQ ,&no-edit JCN
#0008 .Screen/x DEO2 #0008 .Screen/x DEO2
.Screen/height DEI2 #0010 SUB2 .Screen/y DEO2 .Screen/height DEI2 #0010 SUB2 .Screen/y DEO2
;path/name #01 .timer PEK #04 DIV #03 AND #03 MUL ADD ;draw-label JSR2 ;path/name #01 .timer LDZ #04 DIV #03 AND #03 MUL ADD ;draw-label JSR2
&clear &clear
#20 .Screen/color DEO #20 .Screen/color DEO
.Screen/x DEI2 8+ DUP2 .Screen/x DEO2 .Screen/x DEI2 8+ DUP2 .Screen/x DEO2
.Screen/width DEI2 LTH2 ,&clear JCN .Screen/width DEI2 LTH2 ,&clear JCN
( blink ) .timer PEK #01 ADD .timer POK ( blink ) .timer LDZ #01 ADD .timer STZ
&no-edit &no-edit
BRK BRK
@ -118,32 +118,32 @@ BRK
;draw-cursor JSR2 ;draw-cursor JSR2
( release drag ) ( release drag )
.Mouse/state DEI #00 EQU .brush/drag PEK #01 EQU #0101 NEQ2 ,&no-release JCN .Mouse/state DEI #00 EQU .brush/drag LDZ #01 EQU #0101 NEQ2 ,&no-release JCN
.origin/x1 PEK2 #0002 SUB2 .origin/y1 PEK2 #0002 SUB2 .origin/x2 PEK2 #0002 ADD2 .origin/y2 PEK2 #0002 ADD2 #00 ;fill-rect JSR2 .origin/x1 LDZ2 #0002 SUB2 .origin/y1 LDZ2 #0002 SUB2 .origin/x2 LDZ2 #0002 ADD2 .origin/y2 LDZ2 #0002 ADD2 #00 ;fill-rect JSR2
.canvas/x1 PEK2 -- .canvas/y1 PEK2 -- .canvas/x2 PEK2 .canvas/y2 PEK2 #10 ;line-rect JSR2 .canvas/x1 LDZ2 -- .canvas/y1 LDZ2 -- .canvas/x2 LDZ2 .canvas/y2 LDZ2 #10 ;line-rect JSR2
;draw-background JSR2 ;draw-background JSR2
;fit-canvas JSR2 ;fit-canvas JSR2
;draw-foreground JSR2 ;draw-foreground JSR2
#00 .brush/drag POK #00 .brush/drag STZ
&no-release &no-release
( operations on release line/rect ) ( operations on release line/rect )
.Mouse/state DEI .brush/last PEK EQU ;&no-touch-change JCN2 .Mouse/state DEI .brush/last LDZ EQU ;&no-touch-change JCN2
.Mouse/x DEI2 CLN2r .canvas/x1 PEK2 GTS2 STH2r .canvas/x2 PEK2 LTS2 #0101 NEQ2 ;&no-touch-change JCN2 .Mouse/x DEI2 CLN2r .canvas/x1 LDZ2 GTS2 STH2r .canvas/x2 LDZ2 LTS2 #0101 NEQ2 ;&no-touch-change JCN2
.Mouse/y DEI2 CLN2r .canvas/y1 PEK2 GTS2 STH2r .canvas/y2 PEK2 LTS2 #0101 NEQ2 ;&no-touch-change JCN2 .Mouse/y DEI2 CLN2r .canvas/y1 LDZ2 GTS2 STH2r .canvas/y2 LDZ2 LTS2 #0101 NEQ2 ;&no-touch-change JCN2
.Mouse/state DEI #00 EQU ,&no-touch-ondown JCN .Mouse/state DEI #00 EQU ,&no-touch-ondown JCN
( on down ) ( on down )
.Mouse/x DEI2 .cursor/dx POK2 .Mouse/x DEI2 .cursor/dx STZ2
.Mouse/y DEI2 .cursor/dy POK2 .Mouse/y DEI2 .cursor/dy STZ2
&no-touch-ondown &no-touch-ondown
.Mouse/state DEI #00 NEQ ,&no-touch-onup JCN .Mouse/state DEI #00 NEQ ,&no-touch-onup JCN
( on up ) ( on up )
.brush/tool PEK #02 NEQ ,&no-touch-line JCN .brush/tool LDZ #02 NEQ ,&no-touch-line JCN
.cursor/dx PEK2 .canvas/x1 PEK2 SUB2 .cursor/dy PEK2 .canvas/y1 PEK2 SUB2 .Mouse/x DEI2 .canvas/x1 PEK2 SUB2 .Mouse/y DEI2 .canvas/y1 PEK2 SUB2 ;paint-line JSR2 .cursor/dx LDZ2 .canvas/x1 LDZ2 SUB2 .cursor/dy LDZ2 .canvas/y1 LDZ2 SUB2 .Mouse/x DEI2 .canvas/x1 LDZ2 SUB2 .Mouse/y DEI2 .canvas/y1 LDZ2 SUB2 ;paint-line JSR2
;&touch-end JMP2 ;&touch-end JMP2
&no-touch-line &no-touch-line
.brush/tool PEK #03 NEQ ,&no-touch-rect JCN .brush/tool LDZ #03 NEQ ,&no-touch-rect JCN
.cursor/dx PEK2 .canvas/x1 PEK2 SUB2 .cursor/dy PEK2 .canvas/y1 PEK2 SUB2 .Mouse/x DEI2 .canvas/x1 PEK2 SUB2 .Mouse/y DEI2 .canvas/y1 PEK2 SUB2 ;paint-rect JSR2 .cursor/dx LDZ2 .canvas/x1 LDZ2 SUB2 .cursor/dy LDZ2 .canvas/y1 LDZ2 SUB2 .Mouse/x DEI2 .canvas/x1 LDZ2 SUB2 .Mouse/y DEI2 .canvas/y1 LDZ2 SUB2 ;paint-rect JSR2
;&touch-end JMP2 ;&touch-end JMP2
&no-touch-rect &no-touch-rect
&no-touch-onup &no-touch-onup
@ -153,69 +153,69 @@ BRK
( drag ) ( drag )
.Controller/button DEI #02 NEQ ;&no-drag JCN2 .Controller/button DEI #02 NEQ ;&no-drag JCN2
.brush/drag PEK #00 NEQ ,&no-drag-start JCN .brush/drag LDZ #00 NEQ ,&no-drag-start JCN
.canvas/x1 PEK2 .origin/x1 POK2 .canvas/x1 LDZ2 .origin/x1 STZ2
.canvas/y1 PEK2 .origin/y1 POK2 .canvas/y1 LDZ2 .origin/y1 STZ2
.canvas/x2 PEK2 .origin/x2 POK2 .canvas/x2 LDZ2 .origin/x2 STZ2
.canvas/y2 PEK2 .origin/y2 POK2 .canvas/y2 LDZ2 .origin/y2 STZ2
&no-drag-start &no-drag-start
.canvas/x1 PEK2 -- .canvas/y1 PEK2 -- .canvas/x2 PEK2 .canvas/y2 PEK2 #10 ;line-rect JSR2 .canvas/x1 LDZ2 -- .canvas/y1 LDZ2 -- .canvas/x2 LDZ2 .canvas/y2 LDZ2 #10 ;line-rect JSR2
.canvas/x1 PEK2 .Mouse/x DEI2 .cursor/x0 PEK2 SUB2 ADD2 .canvas/x1 POK2 .canvas/x1 LDZ2 .Mouse/x DEI2 .cursor/x0 LDZ2 SUB2 ADD2 .canvas/x1 STZ2
.canvas/y1 PEK2 .Mouse/y DEI2 .cursor/y0 PEK2 SUB2 ADD2 .canvas/y1 POK2 .canvas/y1 LDZ2 .Mouse/y DEI2 .cursor/y0 LDZ2 SUB2 ADD2 .canvas/y1 STZ2
.canvas/w PEK2 8* .canvas/x1 PEK2 ADD2 .canvas/x2 POK2 .canvas/w LDZ2 8* .canvas/x1 LDZ2 ADD2 .canvas/x2 STZ2
.canvas/h PEK2 8* .canvas/y1 PEK2 ADD2 .canvas/y2 POK2 .canvas/h LDZ2 8* .canvas/y1 LDZ2 ADD2 .canvas/y2 STZ2
.canvas/x1 PEK2 -- .canvas/y1 PEK2 -- .canvas/x2 PEK2 .canvas/y2 PEK2 #13 ;line-rect JSR2 .canvas/x1 LDZ2 -- .canvas/y1 LDZ2 -- .canvas/x2 LDZ2 .canvas/y2 LDZ2 #13 ;line-rect JSR2
#01 .brush/drag POK #01 .brush/drag STZ
;&touch-end JMP2 ;&touch-end JMP2
&no-drag &no-drag
( in sizepane ) ( in sizepane )
.Mouse/x DEI2 CLN2r .sizepane/x1 PEK2 GTH2 STH2r .sizepane/x2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-sizepane JCN .Mouse/x DEI2 CLN2r .sizepane/x1 LDZ2 GTH2 STH2r .sizepane/x2 LDZ2 LTH2 #0101 NEQ2 ,&no-touch-sizepane JCN
.Mouse/y DEI2 CLN2r .sizepane/y1 PEK2 GTH2 STH2r .sizepane/y2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-sizepane JCN .Mouse/y DEI2 CLN2r .sizepane/y1 LDZ2 GTH2 STH2r .sizepane/y2 LDZ2 LTH2 #0101 NEQ2 ,&no-touch-sizepane JCN
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
#01 .brush/tool POK #01 .brush/tool STZ
.Mouse/x DEI2 .sizepane/x1 PEK2 SUB2 8/ SWP POP .brush/size POK .Mouse/x DEI2 .sizepane/x1 LDZ2 SUB2 8/ SWP POP .brush/size STZ
( draw ) ;draw-sizepane JSR2 ( draw ) ;draw-sizepane JSR2
( draw ) ;draw-toolpane JSR2 ( draw ) ;draw-toolpane JSR2
;&touch-end JMP2 ;&touch-end JMP2
&no-touch-sizepane &no-touch-sizepane
( in pattpane ) ( in pattpane )
.Mouse/x DEI2 CLN2r .pattpane/x1 PEK2 GTH2 STH2r .pattpane/x2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-pattpane JCN .Mouse/x DEI2 CLN2r .pattpane/x1 LDZ2 GTH2 STH2r .pattpane/x2 LDZ2 LTH2 #0101 NEQ2 ,&no-touch-pattpane JCN
.Mouse/y DEI2 CLN2r .pattpane/y1 PEK2 GTH2 STH2r .pattpane/y2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-pattpane JCN .Mouse/y DEI2 CLN2r .pattpane/y1 LDZ2 GTH2 STH2r .pattpane/y2 LDZ2 LTH2 #0101 NEQ2 ,&no-touch-pattpane JCN
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
.Mouse/x DEI2 .pattpane/x1 PEK2 SUB2 8/ SWP POP .brush/patt POK .Mouse/x DEI2 .pattpane/x1 LDZ2 SUB2 8/ SWP POP .brush/patt STZ
( draw ) ;draw-pattpane JSR2 ( draw ) ;draw-pattpane JSR2
;&touch-end JMP2 ;&touch-end JMP2
&no-touch-pattpane &no-touch-pattpane
( in toolpane ) ( in toolpane )
.Mouse/x DEI2 CLN2r .toolpane/x1 PEK2 GTH2 STH2r .toolpane/x2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-toolpane JCN .Mouse/x DEI2 CLN2r .toolpane/x1 LDZ2 GTH2 STH2r .toolpane/x2 LDZ2 LTH2 #0101 NEQ2 ,&no-touch-toolpane JCN
.Mouse/y DEI2 CLN2r .toolpane/y1 PEK2 GTH2 STH2r .toolpane/y2 PEK2 LTH2 #0101 NEQ2 ,&no-touch-toolpane JCN .Mouse/y DEI2 CLN2r .toolpane/y1 LDZ2 GTH2 STH2r .toolpane/y2 LDZ2 LTH2 #0101 NEQ2 ,&no-touch-toolpane JCN
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
.Mouse/x DEI2 .toolpane/x1 PEK2 SUB2 8/ SWP POP .brush/tool POK .Mouse/x DEI2 .toolpane/x1 LDZ2 SUB2 8/ SWP POP .brush/tool STZ
( draw ) ;draw-toolpane JSR2 ( draw ) ;draw-toolpane JSR2
;&touch-end JMP2 ;&touch-end JMP2
&no-touch-toolpane &no-touch-toolpane
( in viewpane ) ( in viewpane )
.Mouse/x DEI2 CLN2r .viewpane/x1 PEK2 GTH2 STH2r .viewpane/x2 PEK2 LTH2 #0101 NEQ2 ;&no-touch-viewpane JCN2 .Mouse/x DEI2 CLN2r .viewpane/x1 LDZ2 GTH2 STH2r .viewpane/x2 LDZ2 LTH2 #0101 NEQ2 ;&no-touch-viewpane JCN2
.Mouse/y DEI2 CLN2r .viewpane/y1 PEK2 GTH2 STH2r .viewpane/y2 PEK2 LTH2 #0101 NEQ2 ;&no-touch-viewpane JCN2 .Mouse/y DEI2 CLN2r .viewpane/y1 LDZ2 GTH2 STH2r .viewpane/y2 LDZ2 LTH2 #0101 NEQ2 ;&no-touch-viewpane JCN2
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
( clear ) .canvas/x1 PEK2 #0002 SUB2 .canvas/y1 PEK2 #0002 SUB2 .canvas/x2 PEK2 #0002 ADD2 .canvas/y2 PEK2 #0002 ADD2 #00 ;fill-rect JSR2 ( clear ) .canvas/x1 LDZ2 #0002 SUB2 .canvas/y1 LDZ2 #0002 SUB2 .canvas/x2 LDZ2 #0002 ADD2 .canvas/y2 LDZ2 #0002 ADD2 #00 ;fill-rect JSR2
;draw-background JSR2 ;draw-background JSR2
.Mouse/x DEI2 .viewpane/x1 PEK2 SUB2 8/ SWP POP .Mouse/x DEI2 .viewpane/x1 LDZ2 SUB2 8/ SWP POP
DUP #00 NEQ ,&no-incwidth JCN DUP #00 NEQ ,&no-incwidth JCN
.canvas/w PEK2 ++ .canvas/w POK2 .canvas/w LDZ2 ++ .canvas/w STZ2
&no-incwidth &no-incwidth
DUP #01 NEQ ,&no-decwidth JCN DUP #01 NEQ ,&no-decwidth JCN
.canvas/w PEK2 -- .canvas/w POK2 .canvas/w LDZ2 -- .canvas/w STZ2
&no-decwidth &no-decwidth
DUP #02 NEQ ,&no-incheight JCN DUP #02 NEQ ,&no-incheight JCN
.canvas/h PEK2 ++ .canvas/h POK2 .canvas/h LDZ2 ++ .canvas/h STZ2
&no-incheight &no-incheight
DUP #03 NEQ ,&no-decheight JCN DUP #03 NEQ ,&no-decheight JCN
.canvas/h PEK2 -- .canvas/h POK2 .canvas/h LDZ2 -- .canvas/h STZ2
&no-decheight &no-decheight
POP POP
;fit-canvas JSR2 ;fit-canvas JSR2
@ -224,27 +224,27 @@ BRK
&no-touch-viewpane &no-touch-viewpane
( in canvas ) ( in canvas )
.Mouse/x DEI2 CLN2r .canvas/x1 PEK2 GTS2 STH2r .canvas/x2 PEK2 LTS2 #0101 NEQ2 ;&no-touch-canvas JCN2 .Mouse/x DEI2 CLN2r .canvas/x1 LDZ2 GTS2 STH2r .canvas/x2 LDZ2 LTS2 #0101 NEQ2 ;&no-touch-canvas JCN2
.Mouse/y DEI2 CLN2r .canvas/y1 PEK2 GTS2 STH2r .canvas/y2 PEK2 LTS2 #0101 NEQ2 ;&no-touch-canvas JCN2 .Mouse/y DEI2 CLN2r .canvas/y1 LDZ2 GTS2 STH2r .canvas/y2 LDZ2 LTS2 #0101 NEQ2 ;&no-touch-canvas JCN2
( set cursor operation ) ( set cursor operation )
;add-pixel .Mouse/state DEI #01 EQU ;&no-oper JCN2 POP2 ;remove-pixel &no-oper .brush/oper POK2 ;add-pixel .Mouse/state DEI #01 EQU ;&no-oper JCN2 POP2 ;remove-pixel &no-oper .brush/oper STZ2
.brush/tool PEK #00 NEQ ,&no-touch-pen JCN .brush/tool LDZ #00 NEQ ,&no-touch-pen JCN
.cursor/x0 PEK2 .canvas/x1 PEK2 SUB2 .cursor/y0 PEK2 .canvas/y1 PEK2 SUB2 .Mouse/x DEI2 .canvas/x1 PEK2 SUB2 .Mouse/y DEI2 .canvas/y1 PEK2 SUB2 ;paint-line JSR2 .cursor/x0 LDZ2 .canvas/x1 LDZ2 SUB2 .cursor/y0 LDZ2 .canvas/y1 LDZ2 SUB2 .Mouse/x DEI2 .canvas/x1 LDZ2 SUB2 .Mouse/y DEI2 .canvas/y1 LDZ2 SUB2 ;paint-line JSR2
;&touch-end JMP2 ;&touch-end JMP2
&no-touch-pen &no-touch-pen
.brush/tool PEK #01 NEQ ,&no-touch-brush JCN .brush/tool LDZ #01 NEQ ,&no-touch-brush JCN
.Mouse/x DEI2 .canvas/x1 PEK2 SUB2 .Mouse/y DEI2 .canvas/y1 PEK2 SUB2 ;paint-brush JSR2 .Mouse/x DEI2 .canvas/x1 LDZ2 SUB2 .Mouse/y DEI2 .canvas/y1 LDZ2 SUB2 ;paint-brush JSR2
;&touch-end JMP2 ;&touch-end JMP2
&no-touch-brush &no-touch-brush
.brush/tool PEK #04 NEQ ,&no-touch-zoom JCN .brush/tool LDZ #04 NEQ ,&no-touch-zoom JCN
.zoom/active PEK #00 EQU .zoom/active POK .zoom/active LDZ #00 EQU .zoom/active STZ
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
.Mouse/x DEI2 .canvas/x1 PEK2 SUB2 .canvas/w PEK2 2/ SUB2 .zoom/x POK2 .Mouse/x DEI2 .canvas/x1 LDZ2 SUB2 .canvas/w LDZ2 2/ SUB2 .zoom/x STZ2
.Mouse/y DEI2 .canvas/y1 PEK2 SUB2 .canvas/h PEK2 2/ SUB2 .zoom/y POK2 .Mouse/y DEI2 .canvas/y1 LDZ2 SUB2 .canvas/h LDZ2 2/ SUB2 .zoom/y STZ2
;redraw JSR2 ;redraw JSR2
;&touch-end JMP2 ;&touch-end JMP2
&no-touch-zoom &no-touch-zoom
@ -260,7 +260,7 @@ BRK
&no-eye-button &no-eye-button
DUP #01 NEQ ,&no-rename-button JCN DUP #01 NEQ ,&no-rename-button JCN
;rename JSR2 ;rename JSR2
#01 .document/edit POK #01 .document/edit STZ
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
&no-rename-button &no-rename-button
DUP #02 NEQ ,&no-load-button JCN DUP #02 NEQ ,&no-load-button JCN
@ -280,71 +280,71 @@ BRK
&no-touch &no-touch
.Mouse/x DEI2 .cursor/x0 POK2 .Mouse/x DEI2 .cursor/x0 STZ2
.Mouse/y DEI2 .cursor/y0 POK2 .Mouse/y DEI2 .cursor/y0 STZ2
.Mouse/state DEI .brush/last POK .Mouse/state DEI .brush/last STZ
BRK BRK
@on-button ( -> ) @on-button ( -> )
( if in renaming mode ) ( if in renaming mode )
.document/edit PEK #01 NEQ ;&no-edit JCN2 .document/edit LDZ #01 NEQ ;&no-edit JCN2
.Controller/key DEI #00 EQU ;&no-edit JCN2 .Controller/key DEI #00 EQU ;&no-edit JCN2
( enter ) ( enter )
.Controller/key DEI #0d NEQ ,&no-edit-enter JCN .Controller/key DEI #0d NEQ ,&no-edit-enter JCN
#00 .document/edit POK #00 .document/edit STZ
;redraw JSR2 ;redraw JSR2
BRK BRK
&no-edit-enter &no-edit-enter
( backspace ) ( backspace )
.Controller/key DEI #08 NEQ ,&no-edit-backspace JCN .Controller/key DEI #08 NEQ ,&no-edit-backspace JCN
.path/length PEK #00 EQU ,&edit-end JCN .path/length LDZ #00 EQU ,&edit-end JCN
.path/length PEK #01 SUB .path/length POK .path/length LDZ #01 SUB .path/length STZ
#00 ;path/name #00 .path/length PEK ADD2 STA #00 ;path/name #00 .path/length LDZ ADD2 STA
BRK BRK
&no-edit-backspace &no-edit-backspace
( default ) ( default )
.path/length PEK #1f EQU ,&edit-end JCN .path/length LDZ #1f EQU ,&edit-end JCN
.Controller/key DEI ;path/name #00 .path/length PEK ADD2 STA .Controller/key DEI ;path/name #00 .path/length LDZ ADD2 STA
.path/length PEK #01 ADD .path/length POK .path/length LDZ #01 ADD .path/length STZ
&edit-end &edit-end
#00 ;path/name #00 .path/length PEK ADD2 STA #00 ;path/name #00 .path/length LDZ ADD2 STA
BRK BRK
&no-edit &no-edit
( control zoom ) ( control zoom )
.zoom/active PEK #00 EQU ,&skip-zoom JCN .zoom/active LDZ #00 EQU ,&skip-zoom JCN
.Controller/button DEI #f0 AND .Controller/button DEI #f0 AND
DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN
( move ) .zoom/y PEK2 -- .zoom/y POK2 &no-up ( move ) .zoom/y LDZ2 -- .zoom/y STZ2 &no-up
DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN
( move ) .zoom/y PEK2 ++ .zoom/y POK2 &no-down ( move ) .zoom/y LDZ2 ++ .zoom/y STZ2 &no-down
DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN
( move ) .zoom/x PEK2 -- .zoom/x POK2 &no-left ( move ) .zoom/x LDZ2 -- .zoom/x STZ2 &no-left
DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN
( move ) .zoom/x PEK2 ++ .zoom/x POK2 &no-right ( move ) .zoom/x LDZ2 ++ .zoom/x STZ2 &no-right
#00 EQU #04 JCN ;draw-canvas JSR2 #00 EQU #04 JCN ;draw-canvas JSR2
&skip-zoom &skip-zoom
.Controller/key DEI .Controller/key DEI
DUP #20 NEQ ,&no-space JCN DUP #20 NEQ ,&no-space JCN
( toggle zoom ) .zoom/active PEK #00 EQU .zoom/active POK ;redraw JSR2 &no-space ( toggle zoom ) .zoom/active LDZ #00 EQU .zoom/active STZ ;redraw JSR2 &no-space
DUP #08 NEQ ,&no-backspace JCN DUP #08 NEQ ,&no-backspace JCN
( erase ) ;clear JSR2 &no-backspace ( erase ) ;clear JSR2 &no-backspace
DUP #71 NEQ ,&no-qkey JCN DUP #71 NEQ ,&no-qkey JCN
( tool0 ) #00 .brush/tool POK ;draw-toolpane JSR2 &no-qkey ( tool0 ) #00 .brush/tool STZ ;draw-toolpane JSR2 &no-qkey
DUP #77 NEQ ,&no-wkey JCN DUP #77 NEQ ,&no-wkey JCN
( tool0 ) #01 .brush/tool POK ;draw-toolpane JSR2 &no-wkey ( tool0 ) #01 .brush/tool STZ ;draw-toolpane JSR2 &no-wkey
DUP #65 NEQ ,&no-ekey JCN DUP #65 NEQ ,&no-ekey JCN
( tool0 ) #02 .brush/tool POK ;draw-toolpane JSR2 &no-ekey ( tool0 ) #02 .brush/tool STZ ;draw-toolpane JSR2 &no-ekey
DUP #72 NEQ ,&no-rkey JCN DUP #72 NEQ ,&no-rkey JCN
( tool0 ) #03 .brush/tool POK ;draw-toolpane JSR2 &no-rkey ( tool0 ) #03 .brush/tool STZ ;draw-toolpane JSR2 &no-rkey
DUP #74 NEQ ,&no-tkey JCN DUP #74 NEQ ,&no-tkey JCN
( tool0 ) #04 .brush/tool POK ;draw-toolpane JSR2 &no-tkey ( tool0 ) #04 .brush/tool STZ ;draw-toolpane JSR2 &no-tkey
DUP DUP
DUP #30 GTH SWP #39 LTH #0101 NEQ2 ,&no-numkey JCN DUP #30 GTH SWP #39 LTH #0101 NEQ2 ,&no-numkey JCN
( size ) .Controller/key DEI #31 SUB .brush/size POK ;draw-sizepane JSR2 &no-numkey ( size ) .Controller/key DEI #31 SUB .brush/size STZ ;draw-sizepane JSR2 &no-numkey
POP POP
BRK BRK
@ -352,12 +352,12 @@ BRK
@center ( -- ) @center ( -- )
( clear old ) ( clear old )
.canvas/x1 PEK2 #0002 SUB2 .canvas/y1 PEK2 #0002 SUB2 .canvas/x2 PEK2 #0002 ADD2 .canvas/y2 PEK2 #0002 ADD2 #00 ;fill-rect JSR2 .canvas/x1 LDZ2 #0002 SUB2 .canvas/y1 LDZ2 #0002 SUB2 .canvas/x2 LDZ2 #0002 ADD2 .canvas/y2 LDZ2 #0002 ADD2 #00 ;fill-rect JSR2
;draw-background JSR2 ;draw-background JSR2
.Screen/width DEI2 #0002 DIV2 .canvas/w PEK2 8* 2/ SUB2 .canvas/x1 POK2 .Screen/width DEI2 #0002 DIV2 .canvas/w LDZ2 8* 2/ SUB2 .canvas/x1 STZ2
.Screen/height DEI2 #0002 DIV2 .canvas/h PEK2 8* 2/ SUB2 .canvas/y1 POK2 .Screen/height DEI2 #0002 DIV2 .canvas/h LDZ2 8* 2/ SUB2 .canvas/y1 STZ2
;fit-canvas JSR2 ;fit-canvas JSR2
;draw-foreground JSR2 ;draw-foreground JSR2
@ -367,7 +367,7 @@ RTN
@rename @rename
;untitled_txt ;path/name ;strcpy JSR2 ;untitled_txt ;path/name ;strcpy JSR2
#00 .path/length POK #00 .path/length STZ
RTN RTN
@ -385,21 +385,21 @@ RTN
@present @present
.document/presentation PEK #00 EQU .document/presentation POK .document/presentation LDZ #00 EQU .document/presentation STZ
.document/presentation PEK .document/presentation LDZ
DUP #00 NEQ ,&skip0 JCN DUP #00 NEQ ,&skip0 JCN
.theme/r0 PEK2 .System/r DEO2 .theme/g0 PEK2 .System/g DEO2 .theme/b0 PEK2 .System/b DEO2 .theme/r0 LDZ2 .System/r DEO2 .theme/g0 LDZ2 .System/g DEO2 .theme/b0 LDZ2 .System/b DEO2
&skip0 &skip0
DUP #01 NEQ ,&skip1 JCN DUP #01 NEQ ,&skip1 JCN
.theme/r1 PEK2 .System/r DEO2 .theme/g1 PEK2 .System/g DEO2 .theme/b1 PEK2 .System/b DEO2 .theme/r1 LDZ2 .System/r DEO2 .theme/g1 LDZ2 .System/g DEO2 .theme/b1 LDZ2 .System/b DEO2
&skip1 &skip1
POP POP
.toolpane/x1 PEK2 #0002 SUB2 .toolpane/y1 PEK2 #0002 SUB2 .toolpane/x2 PEK2 ++ .toolpane/y2 PEK2 ++ #00 ;fill-rect JSR2 .toolpane/x1 LDZ2 #0002 SUB2 .toolpane/y1 LDZ2 #0002 SUB2 .toolpane/x2 LDZ2 ++ .toolpane/y2 LDZ2 ++ #00 ;fill-rect JSR2
.pattpane/x1 PEK2 #0002 SUB2 .pattpane/y1 PEK2 #0002 SUB2 .pattpane/x2 PEK2 ++ .pattpane/y2 PEK2 ++ #00 ;fill-rect JSR2 .pattpane/x1 LDZ2 #0002 SUB2 .pattpane/y1 LDZ2 #0002 SUB2 .pattpane/x2 LDZ2 ++ .pattpane/y2 LDZ2 ++ #00 ;fill-rect JSR2
.sizepane/x1 PEK2 #0002 SUB2 .sizepane/y1 PEK2 #0002 SUB2 .sizepane/x2 PEK2 ++ .sizepane/y2 PEK2 ++ #00 ;fill-rect JSR2 .sizepane/x1 LDZ2 #0002 SUB2 .sizepane/y1 LDZ2 #0002 SUB2 .sizepane/x2 LDZ2 ++ .sizepane/y2 LDZ2 ++ #00 ;fill-rect JSR2
.viewpane/x1 PEK2 #0002 SUB2 .viewpane/y1 PEK2 #0002 SUB2 .viewpane/x2 PEK2 ++ .viewpane/y2 PEK2 ++ #00 ;fill-rect JSR2 .viewpane/x1 LDZ2 #0002 SUB2 .viewpane/y1 LDZ2 #0002 SUB2 .viewpane/x2 LDZ2 ++ .viewpane/y2 LDZ2 ++ #00 ;fill-rect JSR2
( clear panes ) ( clear panes )
;redraw JSR2 ;redraw JSR2
@ -408,41 +408,41 @@ RTN
@fit-canvas @fit-canvas
.canvas/w PEK2 8* .canvas/x1 PEK2 ADD2 .canvas/x2 POK2 .canvas/w LDZ2 8* .canvas/x1 LDZ2 ADD2 .canvas/x2 STZ2
.canvas/h PEK2 8* .canvas/y1 PEK2 ADD2 .canvas/y2 POK2 .canvas/h LDZ2 8* .canvas/y1 LDZ2 ADD2 .canvas/y2 STZ2
.canvas/x1 PEK2 -- .canvas/y1 PEK2 -- .canvas/x2 PEK2 .canvas/y2 PEK2 #01 ;line-rect JSR2 .canvas/x1 LDZ2 -- .canvas/y1 LDZ2 -- .canvas/x2 LDZ2 .canvas/y2 LDZ2 #01 ;line-rect JSR2
;draw-canvas JSR2 ;draw-canvas JSR2
RTN RTN
@paint-line ( x1 y1 x2 y2 -- ) @paint-line ( x1 y1 x2 y2 -- )
( load ) .line/y1 POK2 .line/x1 POK2 .line/y2 POK2 .line/x2 POK2 ( load ) .line/y1 STZ2 .line/x1 STZ2 .line/y2 STZ2 .line/x2 STZ2
( trim if zoomed ) ( trim if zoomed )
.zoom/active PEK #01 NEQ ,&no-zoom JCN .zoom/active LDZ #01 NEQ ,&no-zoom JCN
.line/x1 PEK2 8/ .zoom/x PEK2 ADD2 .line/x1 POK2 .line/x1 LDZ2 8/ .zoom/x LDZ2 ADD2 .line/x1 STZ2
.line/y1 PEK2 8/ .zoom/y PEK2 ADD2 .line/y1 POK2 .line/y1 LDZ2 8/ .zoom/y LDZ2 ADD2 .line/y1 STZ2
.line/x2 PEK2 8/ .zoom/x PEK2 ADD2 .line/x2 POK2 .line/x2 LDZ2 8/ .zoom/x LDZ2 ADD2 .line/x2 STZ2
.line/y2 PEK2 8/ .zoom/y PEK2 ADD2 .line/y2 POK2 .line/y2 LDZ2 8/ .zoom/y LDZ2 ADD2 .line/y2 STZ2
&no-zoom &no-zoom
.line/x1 PEK2 .line/x2 PEK2 SUB2 ABS2 .line/dx POK2 .line/x1 LDZ2 .line/x2 LDZ2 SUB2 ABS2 .line/dx STZ2
.line/y1 PEK2 .line/y2 PEK2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy POK2 .line/y1 LDZ2 .line/y2 LDZ2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy STZ2
#ffff #00 .line/x2 PEK2 .line/x1 PEK2 LTS2 #0002 MUL2 ADD2 .line/sx POK2 #ffff #00 .line/x2 LDZ2 .line/x1 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sx STZ2
#ffff #00 .line/y2 PEK2 .line/y1 PEK2 LTS2 #0002 MUL2 ADD2 .line/sy POK2 #ffff #00 .line/y2 LDZ2 .line/y1 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sy STZ2
.line/dx PEK2 .line/dy PEK2 ADD2 .line/e1 POK2 .line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
&loop &loop
( paint ) .line/x2 PEK2 .line/y2 PEK2 .brush/oper PEK2 JSR2 ( paint ) .line/x2 LDZ2 .line/y2 LDZ2 .brush/oper LDZ2 JSR2
.line/x2 PEK2 .line/x1 PEK2 EQU2 .line/y2 PEK2 .line/y1 PEK2 EQU2 #0101 EQU2 ,&end JCN .line/x2 LDZ2 .line/x1 LDZ2 EQU2 .line/y2 LDZ2 .line/y1 LDZ2 EQU2 #0101 EQU2 ,&end JCN
.line/e1 PEK2 #0002 MUL2 .line/e2 POK2 .line/e1 LDZ2 #0002 MUL2 .line/e2 STZ2
.line/e2 PEK2 .line/dy PEK2 LTS2 ,&skipy JCN .line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN
.line/e1 PEK2 .line/dy PEK2 ADD2 .line/e1 POK2 .line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
.line/x2 PEK2 .line/sx PEK2 ADD2 .line/x2 POK2 .line/x2 LDZ2 .line/sx LDZ2 ADD2 .line/x2 STZ2
&skipy &skipy
.line/e2 PEK2 .line/dx PEK2 GTS2 ,&skipx JCN .line/e2 LDZ2 .line/dx LDZ2 GTS2 ,&skipx JCN
.line/e1 PEK2 .line/dx PEK2 ADD2 .line/e1 POK2 .line/e1 LDZ2 .line/dx LDZ2 ADD2 .line/e1 STZ2
.line/y2 PEK2 .line/sy PEK2 ADD2 .line/y2 POK2 .line/y2 LDZ2 .line/sy LDZ2 ADD2 .line/y2 STZ2
&skipx &skipx
;&loop JMP2 ;&loop JMP2
&end &end
@ -454,29 +454,29 @@ RTN
@paint-rect ( x1 y1 x2 y2 -- ) @paint-rect ( x1 y1 x2 y2 -- )
( load ) .rect/y2 POK2 .rect/x2 POK2 .rect/y1 POK2 .rect/x1 POK2 ( load ) .rect/y2 STZ2 .rect/x2 STZ2 .rect/y1 STZ2 .rect/x1 STZ2
( trim if zoomed ) ( trim if zoomed )
.zoom/active PEK #01 NEQ ,&no-zoom JCN .zoom/active LDZ #01 NEQ ,&no-zoom JCN
.rect/x1 PEK2 8/ .zoom/x PEK2 ADD2 .rect/x1 POK2 .rect/x1 LDZ2 8/ .zoom/x LDZ2 ADD2 .rect/x1 STZ2
.rect/y1 PEK2 8/ .zoom/y PEK2 ADD2 .rect/y1 POK2 .rect/y1 LDZ2 8/ .zoom/y LDZ2 ADD2 .rect/y1 STZ2
.rect/x2 PEK2 8/ .zoom/x PEK2 ADD2 #0001 ADD2 .rect/x2 POK2 .rect/x2 LDZ2 8/ .zoom/x LDZ2 ADD2 #0001 ADD2 .rect/x2 STZ2
.rect/y2 PEK2 8/ .zoom/y PEK2 ADD2 #0001 ADD2 .rect/y2 POK2 .rect/y2 LDZ2 8/ .zoom/y LDZ2 ADD2 #0001 ADD2 .rect/y2 STZ2
&no-zoom &no-zoom
.rect/x1 PEK2 .pt2/x POK2 .rect/x1 LDZ2 .pt2/x STZ2
.rect/y1 PEK2 .pt2/y POK2 .rect/y1 LDZ2 .pt2/y STZ2
&ver &ver
.rect/x1 PEK2 .pt2/x POK2 .rect/x1 LDZ2 .pt2/x STZ2
&hor &hor
.pt2/x PEK2 SWP POP .px/x POK .pt2/y PEK2 SWP POP .px/y POK .pt2/x LDZ2 SWP POP .px/x STZ .pt2/y LDZ2 SWP POP .px/y STZ
;patternize JSR2 #00 EQU ,&no-pixel JCN ;patternize JSR2 #00 EQU ,&no-pixel JCN
( draw ) .pt2/x PEK2 .pt2/y PEK2 .brush/oper PEK2 JSR2 &no-pixel ( draw ) .pt2/x LDZ2 .pt2/y LDZ2 .brush/oper LDZ2 JSR2 &no-pixel
( incr ) .pt2/x PEK2 ++ .pt2/x POK2 ( incr ) .pt2/x LDZ2 ++ .pt2/x STZ2
.pt2/x PEK2 .rect/x2 PEK2 LTS2 ,&hor JCN .pt2/x LDZ2 .rect/x2 LDZ2 LTS2 ,&hor JCN
.pt2/y PEK2 ++ .pt2/y POK2 .pt2/y LDZ2 ++ .pt2/y STZ2
.pt2/y PEK2 .rect/y2 PEK2 LTS2 ,&ver JCN .pt2/y LDZ2 .rect/y2 LDZ2 LTS2 ,&ver JCN
;draw-canvas JSR2 ;draw-canvas JSR2
;draw-foreground JSR2 ;draw-foreground JSR2
@ -485,27 +485,27 @@ RTN
@paint-brush ( x y -- ) @paint-brush ( x y -- )
#0003 SUB2 .pt0/y POK2 #0003 SUB2 .pt0/x POK2 ( cursor offset ) #0003 SUB2 .pt0/y STZ2 #0003 SUB2 .pt0/x STZ2 ( cursor offset )
( trim if zoomed ) ( trim if zoomed )
.zoom/active PEK #01 NEQ ,&no-zoom JCN .zoom/active LDZ #01 NEQ ,&no-zoom JCN
.pt0/x PEK2 8/ .zoom/x PEK2 ADD2 #0003 SUB2 .pt0/x POK2 .pt0/x LDZ2 8/ .zoom/x LDZ2 ADD2 #0003 SUB2 .pt0/x STZ2
.pt0/y PEK2 8/ .zoom/y PEK2 ADD2 #0003 SUB2 .pt0/y POK2 .pt0/y LDZ2 8/ .zoom/y LDZ2 ADD2 #0003 SUB2 .pt0/y STZ2
&no-zoom &no-zoom
#00 .px/x POK #00 .px/y POK #00 .px/x STZ #00 .px/y STZ
&ver &ver
#00 .px/x POK #00 .px/x STZ
&hor &hor
( addr ) ;size_icns #00 .brush/size PEK 8* ADD2 ( addr ) ;size_icns #00 .brush/size LDZ 8* ADD2
( byte ) #00 .px/y PEK ADD2 LDA #07 .px/x PEK SUB SFT #01 AND ( byte ) #00 .px/y LDZ ADD2 LDA #07 .px/x LDZ SUB SFT #01 AND
#00 EQU ,&no-pixel JCN #00 EQU ,&no-pixel JCN
;patternize JSR2 #00 EQU ,&no-pixel JCN ;patternize JSR2 #00 EQU ,&no-pixel JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 .brush/oper PEK2 JSR2 &no-pixel .pt0/x LDZ2 #00 .px/x LDZ ADD2 .pt0/y LDZ2 #00 .px/y LDZ ADD2 .brush/oper LDZ2 JSR2 &no-pixel
( incr ) .px/x PEK #01 ADD .px/x POK ( incr ) .px/x LDZ #01 ADD .px/x STZ
.px/x PEK #08 LTH ,&hor JCN .px/x LDZ #08 LTH ,&hor JCN
( incr ) .px/y PEK #01 ADD .px/y POK ( incr ) .px/y LDZ #01 ADD .px/y STZ
.px/y PEK #08 LTH ,&ver JCN .px/y LDZ #08 LTH ,&ver JCN
;draw-canvas JSR2 ;draw-canvas JSR2
;draw-foreground JSR2 ;draw-foreground JSR2
@ -514,38 +514,38 @@ RTN
@patternize ( -- ) @patternize ( -- )
.brush/patt PEK #00 NEQ ,&noplain JCN .brush/patt LDZ #00 NEQ ,&noplain JCN
#01 RTN &noplain #01 RTN &noplain
.brush/patt PEK #01 NEQ ,&notone1 JCN .brush/patt LDZ #01 NEQ ,&notone1 JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 ADD2 #0001 AND2 #0000 EQU2 .pt0/x LDZ2 #00 .px/x LDZ ADD2 .pt0/y LDZ2 #00 .px/y LDZ ADD2 ADD2 #0001 AND2 #0000 EQU2
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 SUB2 #0001 AND2 #0000 EQU2 .pt0/x LDZ2 #00 .px/x LDZ ADD2 .pt0/y LDZ2 #00 .px/y LDZ ADD2 SUB2 #0001 AND2 #0000 EQU2
#0101 EQU2 #0101 EQU2
RTN &notone1 RTN &notone1
.brush/patt PEK #02 NEQ ,&notone2 JCN .brush/patt LDZ #02 NEQ ,&notone2 JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 ADD2 #0003 AND2 #0000 EQU2 .pt0/x LDZ2 #00 .px/x LDZ ADD2 .pt0/y LDZ2 #00 .px/y LDZ ADD2 ADD2 #0003 AND2 #0000 EQU2
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 SUB2 #0003 AND2 #0000 EQU2 .pt0/x LDZ2 #00 .px/x LDZ ADD2 .pt0/y LDZ2 #00 .px/y LDZ ADD2 SUB2 #0003 AND2 #0000 EQU2
#0101 EQU2 #0101 EQU2
RTN &notone2 RTN &notone2
.brush/patt PEK #03 NEQ ,&notone3 JCN .brush/patt LDZ #03 NEQ ,&notone3 JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 ADD2 #0005 AND2 #0000 EQU2 .pt0/x LDZ2 #00 .px/x LDZ ADD2 .pt0/y LDZ2 #00 .px/y LDZ ADD2 ADD2 #0005 AND2 #0000 EQU2
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 SUB2 #0005 AND2 #0000 EQU2 .pt0/x LDZ2 #00 .px/x LDZ ADD2 .pt0/y LDZ2 #00 .px/y LDZ ADD2 SUB2 #0005 AND2 #0000 EQU2
#0101 EQU2 #0101 EQU2
RTN &notone3 RTN &notone3
.brush/patt PEK #04 NEQ ,&notone4 JCN .brush/patt LDZ #04 NEQ ,&notone4 JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 ADD2 #0003 AND2 #0000 EQU2 RTN &notone4 .pt0/x LDZ2 #00 .px/x LDZ ADD2 .pt0/y LDZ2 #00 .px/y LDZ ADD2 ADD2 #0003 AND2 #0000 EQU2 RTN &notone4
.brush/patt PEK #05 NEQ ,&notone5 JCN .brush/patt LDZ #05 NEQ ,&notone5 JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 SUB2 #0003 AND2 #0000 EQU2 RTN &notone5 .pt0/x LDZ2 #00 .px/x LDZ ADD2 .pt0/y LDZ2 #00 .px/y LDZ ADD2 SUB2 #0003 AND2 #0000 EQU2 RTN &notone5
.brush/patt PEK #06 NEQ ,&notone6 JCN .brush/patt LDZ #06 NEQ ,&notone6 JCN
.pt0/x PEK2 #00 .px/x PEK ADD2 #0001 AND2 SWP POP RTN &notone6 .pt0/x LDZ2 #00 .px/x LDZ ADD2 #0001 AND2 SWP POP RTN &notone6
.brush/patt PEK #07 NEQ ,&notone7 JCN .brush/patt LDZ #07 NEQ ,&notone7 JCN
.pt0/y PEK2 #00 .px/y PEK ADD2 #0001 AND2 SWP POP RTN &notone7 .pt0/y LDZ2 #00 .px/y LDZ ADD2 #0001 AND2 SWP POP RTN &notone7
#00 #00
@ -553,30 +553,30 @@ RTN
@get-pixel ( x y -- b ) @get-pixel ( x y -- b )
SWP POP #07 AND .px/y POK SWP POP #07 AND .px/y STZ
SWP POP #07 AND .px/x POK SWP POP #07 AND .px/x STZ
( get tile ) .pt1/x PEK2 8/ .pt1/y PEK2 8/ .canvas/w PEK2 MUL2 ADD2 8* ( get tile ) .pt1/x LDZ2 8/ .pt1/y LDZ2 8/ .canvas/w LDZ2 MUL2 ADD2 8*
( add addr ) ;data ADD2 ( add addr ) ;data ADD2
#00 .px/y PEK ADD2 LDA #07 .px/x PEK SUB SFT #01 AND #00 .px/y LDZ ADD2 LDA #07 .px/x LDZ SUB SFT #01 AND
RTN RTN
@add-pixel ( x y -- ) @add-pixel ( x y -- )
.pt1/y POK2 .pt1/x POK2 .pt1/y STZ2 .pt1/x STZ2
( get tile addr ) ;data .pt1/x PEK2 8/ .pt1/y PEK2 8/ .canvas/w PEK2 MUL2 ADD2 8* .pt1/y PEK2 MOD8 ADD2 ADD2 ( get tile addr ) ;data .pt1/x LDZ2 8/ .pt1/y LDZ2 8/ .canvas/w LDZ2 MUL2 ADD2 8* .pt1/y LDZ2 MOD8 ADD2 ADD2
( load ) DUP2 LDA ( load ) DUP2 LDA
( mask ) #01 #07 .pt1/x PEK2 MOD8 SWP POP SUB SFL ORA ( mask ) #01 #07 .pt1/x LDZ2 MOD8 SWP POP SUB SFL ORA
( save ) ROT ROT STA ( save ) ROT ROT STA
RTN RTN
@remove-pixel ( x y -- ) @remove-pixel ( x y -- )
.pt1/y POK2 .pt1/x POK2 .pt1/y STZ2 .pt1/x STZ2
( get tile addr ) ;data .pt1/x PEK2 8/ .pt1/y PEK2 8/ .canvas/w PEK2 MUL2 ADD2 8* .pt1/y PEK2 MOD8 ADD2 ADD2 ( get tile addr ) ;data .pt1/x LDZ2 8/ .pt1/y LDZ2 8/ .canvas/w LDZ2 MUL2 ADD2 8* .pt1/y LDZ2 MOD8 ADD2 ADD2
( load ) DUP2 LDA ( load ) DUP2 LDA
( mask ) #01 #07 .pt1/x PEK2 MOD8 SWP POP SUB SFL #ff EOR AND ( mask ) #01 #07 .pt1/x LDZ2 MOD8 SWP POP SUB SFL #ff EOR AND
( save ) ROT ROT STA ( save ) ROT ROT STA
RTN RTN
@ -609,39 +609,39 @@ RTN
@draw-canvas ( -- ) @draw-canvas ( -- )
.zoom/active PEK #01 EQU ;draw-canvas-zoom JCN2 .zoom/active LDZ #01 EQU ;draw-canvas-zoom JCN2
.canvas/y1 PEK2 .Screen/y DEO2 .canvas/y1 LDZ2 .Screen/y DEO2
;data .Screen/addr DEO2 ;data .Screen/addr DEO2
&ver &ver
.canvas/x1 PEK2 .Screen/x DEO2 .canvas/x1 LDZ2 .Screen/x DEO2
&hor &hor
( draw ) #29 .Screen/color DEO ( draw ) #29 .Screen/color DEO
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2 ( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2 ( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2
.Screen/x DEI2 .canvas/x2 PEK2 NEQ2 ,&hor JCN .Screen/x DEI2 .canvas/x2 LDZ2 NEQ2 ,&hor JCN
( incr ) .Screen/y DEI2 8+ .Screen/y DEO2 ( incr ) .Screen/y DEI2 8+ .Screen/y DEO2
.Screen/y DEI2 .canvas/y2 PEK2 NEQ2 ,&ver JCN .Screen/y DEI2 .canvas/y2 LDZ2 NEQ2 ,&ver JCN
RTN RTN
@draw-canvas-zoom ( -- ) @draw-canvas-zoom ( -- )
.zoom/y PEK2 .pt1/y POK2 .zoom/y LDZ2 .pt1/y STZ2
.canvas/y1 PEK2 .Screen/y DEO2 .canvas/y1 LDZ2 .Screen/y DEO2
;data .Screen/addr DEO2 ;data .Screen/addr DEO2
&ver &ver
.canvas/x1 PEK2 .Screen/x DEO2 .canvas/x1 LDZ2 .Screen/x DEO2
.zoom/x PEK2 .pt1/x POK2 .zoom/x LDZ2 .pt1/x STZ2
&hor &hor
( incr ) ;bigpixel_icn #0008 #00 .pt1/x PEK2 .pt1/y PEK2 ;get-pixel JSR2 MUL2 ADD2 .Screen/addr DEO2 ( incr ) ;bigpixel_icn #0008 #00 .pt1/x LDZ2 .pt1/y LDZ2 ;get-pixel JSR2 MUL2 ADD2 .Screen/addr DEO2
( draw ) #29 .Screen/color DEO ( draw ) #29 .Screen/color DEO
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2 ( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( incr ) .pt1/x PEK2 ++ .pt1/x POK2 ( incr ) .pt1/x LDZ2 ++ .pt1/x STZ2
.Screen/x DEI2 .canvas/x2 PEK2 NEQ2 ,&hor JCN .Screen/x DEI2 .canvas/x2 LDZ2 NEQ2 ,&hor JCN
( incr ) .Screen/y DEI2 8+ .Screen/y DEO2 ( incr ) .Screen/y DEI2 8+ .Screen/y DEO2
( incr ) .pt1/y PEK2 ++ .pt1/y POK2 ( incr ) .pt1/y LDZ2 ++ .pt1/y STZ2
.Screen/y DEI2 .canvas/y2 PEK2 NEQ2 ,&ver JCN .Screen/y DEI2 .canvas/y2 LDZ2 NEQ2 ,&ver JCN
RTN RTN
@ -649,28 +649,28 @@ RTN
;blank_icn .Screen/addr DEO2 ;blank_icn .Screen/addr DEO2
( clear brush size ) ( clear brush size )
.cursor/x PEK2 #0003 SUB2 .Screen/x DEO2 .cursor/y PEK2 #0003 SUB2 .Screen/y DEO2 #30 .Screen/color DEO .cursor/x LDZ2 #0003 SUB2 .Screen/x DEO2 .cursor/y LDZ2 #0003 SUB2 .Screen/y DEO2 #30 .Screen/color DEO
( clear last cursor ) ( clear last cursor )
.cursor/x PEK2 .Screen/x DEO2 .cursor/y PEK2 .Screen/y DEO2 #30 .Screen/color DEO .cursor/x LDZ2 .Screen/x DEO2 .cursor/y LDZ2 .Screen/y DEO2 #30 .Screen/color DEO
( record cursor positions ) ( record cursor positions )
.Mouse/x DEI2 .cursor/x POK2 .Mouse/y DEI2 .cursor/y POK2 .Mouse/x DEI2 .cursor/x STZ2 .Mouse/y DEI2 .cursor/y STZ2
( draw size cursor ) ( draw size cursor )
.brush/tool PEK #01 NEQ ;&outside-canvas JCN2 .brush/tool LDZ #01 NEQ ;&outside-canvas JCN2
( do not draw size when holding alt ) ( do not draw size when holding alt )
.Controller/button DEI #02 EQU ;&outside-canvas JCN2 .Controller/button DEI #02 EQU ;&outside-canvas JCN2
.Mouse/x DEI2 CLN2r .canvas/x1 PEK2 GTH2 STH2r .canvas/x2 PEK2 LTH2 #0101 NEQ2 ;&outside-canvas JCN2 .Mouse/x DEI2 CLN2r .canvas/x1 LDZ2 GTH2 STH2r .canvas/x2 LDZ2 LTH2 #0101 NEQ2 ;&outside-canvas JCN2
.Mouse/y DEI2 CLN2r .canvas/y1 PEK2 GTH2 STH2r .canvas/y2 PEK2 LTH2 #0101 NEQ2 ;&outside-canvas JCN2 .Mouse/y DEI2 CLN2r .canvas/y1 LDZ2 GTH2 STH2r .canvas/y2 LDZ2 LTH2 #0101 NEQ2 ;&outside-canvas JCN2
( do not draw size in toolpane ) ( do not draw size in toolpane )
.Mouse/x DEI2 CLN2r .toolpane/x1 PEK2 GTH2 STH2r .toolpane/x2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 CLN2r .toolpane/y1 PEK2 GTH2 STH2r .toolpane/y2 PEK2 LTH2 #0101 EQU2 #0101 EQU2 ;&outside-canvas JCN2 .Mouse/x DEI2 CLN2r .toolpane/x1 LDZ2 GTH2 STH2r .toolpane/x2 LDZ2 LTH2 #0101 EQU2 .Mouse/y DEI2 CLN2r .toolpane/y1 LDZ2 GTH2 STH2r .toolpane/y2 LDZ2 LTH2 #0101 EQU2 #0101 EQU2 ;&outside-canvas JCN2
.Mouse/x DEI2 CLN2r .sizepane/x1 PEK2 GTH2 STH2r .sizepane/x2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 CLN2r .sizepane/y1 PEK2 GTH2 STH2r .sizepane/y2 PEK2 LTH2 #0101 EQU2 #0101 EQU2 ;&outside-canvas JCN2 .Mouse/x DEI2 CLN2r .sizepane/x1 LDZ2 GTH2 STH2r .sizepane/x2 LDZ2 LTH2 #0101 EQU2 .Mouse/y DEI2 CLN2r .sizepane/y1 LDZ2 GTH2 STH2r .sizepane/y2 LDZ2 LTH2 #0101 EQU2 #0101 EQU2 ;&outside-canvas JCN2
.Mouse/x DEI2 CLN2r .pattpane/x1 PEK2 GTH2 STH2r .pattpane/x2 PEK2 LTH2 #0101 EQU2 .Mouse/y DEI2 CLN2r .pattpane/y1 PEK2 GTH2 STH2r .pattpane/y2 PEK2 LTH2 #0101 EQU2 #0101 EQU2 ;&outside-canvas JCN2 .Mouse/x DEI2 CLN2r .pattpane/x1 LDZ2 GTH2 STH2r .pattpane/x2 LDZ2 LTH2 #0101 EQU2 .Mouse/y DEI2 CLN2r .pattpane/y1 LDZ2 GTH2 STH2r .pattpane/y2 LDZ2 LTH2 #0101 EQU2 #0101 EQU2 ;&outside-canvas JCN2
.cursor/x PEK2 #0003 SUB2 .Screen/x DEO2 .cursor/y PEK2 #0003 SUB2 .Screen/y DEO2 .cursor/x LDZ2 #0003 SUB2 .Screen/x DEO2 .cursor/y LDZ2 #0003 SUB2 .Screen/y DEO2
;brush_icns #00 .brush/size PEK 8* ADD2 .Screen/addr DEO2 ;brush_icns #00 .brush/size LDZ 8* ADD2 .Screen/addr DEO2
#31 .Mouse/state DEI #02 MUL ADD .Screen/color DEO #31 .Mouse/state DEI #02 MUL ADD .Screen/color DEO
.Mouse/state DEI #00 EQU ,&outside-canvas JCN RTN .Mouse/state DEI #00 EQU ,&outside-canvas JCN RTN
&outside-canvas &outside-canvas
( draw new cursor ) ( draw new cursor )
.cursor/x PEK2 .Screen/x DEO2 .cursor/y PEK2 .Screen/y DEO2 .cursor/x LDZ2 .Screen/x DEO2 .cursor/y LDZ2 .Screen/y DEO2
;pointers_icn #00 .Controller/button DEI #02 EQU 8* ADD2 .Screen/addr DEO2 ;pointers_icn #00 .Controller/button DEI #02 EQU 8* ADD2 .Screen/addr DEO2
#3f .Mouse/state DEI #01 EQU #0a MUL SUB .Screen/color DEO #3f .Mouse/state DEI #01 EQU #0a MUL SUB .Screen/color DEO
@ -678,79 +678,79 @@ RTN
@draw-toolpane ( -- ) @draw-toolpane ( -- )
.document/presentation PEK #00 EQU ,&skip JCN RTN &skip .document/presentation LDZ #00 EQU ,&skip JCN RTN &skip
( frame ) ( frame )
.toolpane/x1 PEK2 -- .toolpane/y1 PEK2 -- .toolpane/x2 PEK2 .toolpane/y2 PEK2 #00 ;line-rect JSR2 .toolpane/x1 LDZ2 -- .toolpane/y1 LDZ2 -- .toolpane/x2 LDZ2 .toolpane/y2 LDZ2 #00 ;line-rect JSR2
.toolpane/x1 PEK2 #0002 SUB2 .toolpane/y1 PEK2 #0002 SUB2 .toolpane/x2 PEK2 .toolpane/y2 PEK2 #01 ;line-rect JSR2 .toolpane/x1 LDZ2 #0002 SUB2 .toolpane/y1 LDZ2 #0002 SUB2 .toolpane/x2 LDZ2 .toolpane/y2 LDZ2 #01 ;line-rect JSR2
.toolpane/x1 PEK2 .Screen/x DEO2 .toolpane/y1 PEK2 .Screen/y DEO2 ;tool_icns .Screen/addr DEO2 .toolpane/x1 LDZ2 .Screen/x DEO2 .toolpane/y1 LDZ2 .Screen/y DEO2 ;tool_icns .Screen/addr DEO2
&loop &loop
( draw ) #21 .Screen/x DEI2 .toolpane/x1 PEK2 SUB2 8/ SWP POP .brush/tool PEK EQU #02 MUL ADD .Screen/color DEO ( draw ) #21 .Screen/x DEI2 .toolpane/x1 LDZ2 SUB2 8/ SWP POP .brush/tool LDZ EQU #02 MUL ADD .Screen/color DEO
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2 ( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2 ( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2
.Screen/x DEI2 .toolpane/x2 PEK2 LTH2 ,&loop JCN .Screen/x DEI2 .toolpane/x2 LDZ2 LTH2 ,&loop JCN
.zoom/active PEK #01 NEQ ,&no-zoom JCN .zoom/active LDZ #01 NEQ ,&no-zoom JCN
.Screen/x DEI2 #0008 SUB2 .Screen/x DEO2 .Screen/x DEI2 #0008 SUB2 .Screen/x DEO2
;tool_icns #0028 ADD2 .Screen/addr DEO2 ;tool_icns #0028 ADD2 .Screen/addr DEO2
#21 #04 .brush/tool PEK EQU #02 MUL ADD .Screen/color DEO #21 #04 .brush/tool LDZ EQU #02 MUL ADD .Screen/color DEO
&no-zoom &no-zoom
RTN RTN
@draw-pattpane ( -- ) @draw-pattpane ( -- )
.document/presentation PEK #00 EQU ,&skip JCN RTN &skip .document/presentation LDZ #00 EQU ,&skip JCN RTN &skip
( frame ) ( frame )
.pattpane/x1 PEK2 -- .pattpane/y1 PEK2 -- .pattpane/x2 PEK2 .pattpane/y2 PEK2 #00 ;line-rect JSR2 .pattpane/x1 LDZ2 -- .pattpane/y1 LDZ2 -- .pattpane/x2 LDZ2 .pattpane/y2 LDZ2 #00 ;line-rect JSR2
.pattpane/x1 PEK2 #0002 SUB2 .pattpane/y1 PEK2 #0002 SUB2 .pattpane/x2 PEK2 .pattpane/y2 PEK2 #01 ;line-rect JSR2 .pattpane/x1 LDZ2 #0002 SUB2 .pattpane/y1 LDZ2 #0002 SUB2 .pattpane/x2 LDZ2 .pattpane/y2 LDZ2 #01 ;line-rect JSR2
.pattpane/x1 PEK2 .Screen/x DEO2 .pattpane/y1 PEK2 .Screen/y DEO2 ;patt_icns .Screen/addr DEO2 .pattpane/x1 LDZ2 .Screen/x DEO2 .pattpane/y1 LDZ2 .Screen/y DEO2 ;patt_icns .Screen/addr DEO2
&loop &loop
( draw ) #21 .Screen/x DEI2 .pattpane/x1 PEK2 SUB2 8/ SWP POP .brush/patt PEK EQU #02 MUL ADD .Screen/color DEO ( draw ) #21 .Screen/x DEI2 .pattpane/x1 LDZ2 SUB2 8/ SWP POP .brush/patt LDZ EQU #02 MUL ADD .Screen/color DEO
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2 ( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2 ( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2
.Screen/x DEI2 .pattpane/x2 PEK2 LTH2 ,&loop JCN .Screen/x DEI2 .pattpane/x2 LDZ2 LTH2 ,&loop JCN
RTN RTN
@draw-sizepane ( -- ) @draw-sizepane ( -- )
.document/presentation PEK #00 EQU ,&skip JCN RTN &skip .document/presentation LDZ #00 EQU ,&skip JCN RTN &skip
( frame ) ( frame )
.sizepane/x1 PEK2 -- .sizepane/y1 PEK2 -- .sizepane/x2 PEK2 .sizepane/y2 PEK2 #00 ;line-rect JSR2 .sizepane/x1 LDZ2 -- .sizepane/y1 LDZ2 -- .sizepane/x2 LDZ2 .sizepane/y2 LDZ2 #00 ;line-rect JSR2
.sizepane/x1 PEK2 #0002 SUB2 .sizepane/y1 PEK2 #0002 SUB2 .sizepane/x2 PEK2 .sizepane/y2 PEK2 #01 ;line-rect JSR2 .sizepane/x1 LDZ2 #0002 SUB2 .sizepane/y1 LDZ2 #0002 SUB2 .sizepane/x2 LDZ2 .sizepane/y2 LDZ2 #01 ;line-rect JSR2
.sizepane/x1 PEK2 .Screen/x DEO2 .sizepane/y1 PEK2 .Screen/y DEO2 ;size_icns .Screen/addr DEO2 .sizepane/x1 LDZ2 .Screen/x DEO2 .sizepane/y1 LDZ2 .Screen/y DEO2 ;size_icns .Screen/addr DEO2
&loop &loop
( draw ) #21 .Screen/x DEI2 .sizepane/x1 PEK2 SUB2 8/ SWP POP .brush/size PEK EQU #02 MUL ADD .Screen/color DEO ( draw ) #21 .Screen/x DEI2 .sizepane/x1 LDZ2 SUB2 8/ SWP POP .brush/size LDZ EQU #02 MUL ADD .Screen/color DEO
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2 ( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2 ( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2
.Screen/x DEI2 .sizepane/x2 PEK2 LTH2 ,&loop JCN .Screen/x DEI2 .sizepane/x2 LDZ2 LTH2 ,&loop JCN
RTN RTN
@draw-viewpane ( -- ) @draw-viewpane ( -- )
.document/presentation PEK #00 EQU ,&skip JCN RTN &skip .document/presentation LDZ #00 EQU ,&skip JCN RTN &skip
( frame ) ( frame )
.viewpane/x1 PEK2 -- .viewpane/y1 PEK2 -- .viewpane/x2 PEK2 .viewpane/y2 PEK2 #00 ;line-rect JSR2 .viewpane/x1 LDZ2 -- .viewpane/y1 LDZ2 -- .viewpane/x2 LDZ2 .viewpane/y2 LDZ2 #00 ;line-rect JSR2
.viewpane/x1 PEK2 #0002 SUB2 .viewpane/y1 PEK2 #0002 SUB2 .viewpane/x2 PEK2 .viewpane/y2 PEK2 #01 ;line-rect JSR2 .viewpane/x1 LDZ2 #0002 SUB2 .viewpane/y1 LDZ2 #0002 SUB2 .viewpane/x2 LDZ2 .viewpane/y2 LDZ2 #01 ;line-rect JSR2
.viewpane/x1 PEK2 .Screen/x DEO2 .viewpane/y1 PEK2 .Screen/y DEO2 ;view_icns .Screen/addr DEO2 .viewpane/x1 LDZ2 .Screen/x DEO2 .viewpane/y1 LDZ2 .Screen/y DEO2 ;view_icns .Screen/addr DEO2
&loop &loop
( draw ) #21 .Screen/color DEO ( draw ) #21 .Screen/color DEO
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2 ( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2 ( incr ) .Screen/addr DEI2 8+ .Screen/addr DEO2
.Screen/x DEI2 .viewpane/x2 PEK2 LTH2 ,&loop JCN .Screen/x DEI2 .viewpane/x2 LDZ2 LTH2 ,&loop JCN
RTN RTN
@ -766,29 +766,29 @@ RTN
@draw-background @draw-background
( draw hor line ) ( draw hor line )
#0000 .Screen/width DEI2 .Screen/height DEI2 #0002 DIV2 .document/presentation PEK #00 EQU ;line-horizontal-dotted JSR2 #0000 .Screen/width DEI2 .Screen/height DEI2 #0002 DIV2 .document/presentation LDZ #00 EQU ;line-horizontal-dotted JSR2
( draw ver line ) ( draw ver line )
.Screen/width DEI2 #0002 DIV2 #0000 .Screen/height DEI2 .document/presentation PEK #00 EQU ;line-vertical-dotted JSR2 .Screen/width DEI2 #0002 DIV2 #0000 .Screen/height DEI2 .document/presentation LDZ #00 EQU ;line-vertical-dotted JSR2
.document/presentation PEK #01 EQU ;&skip-size JCN2 .document/presentation LDZ #01 EQU ;&skip-size JCN2
( draw size ) ( draw size )
#0010 .Screen/y DEO2 #0010 .Screen/y DEO2
( draw width ) ( draw width )
.Screen/width DEI2 #00a0 SUB2 .Screen/x DEO2 ;font_hex .canvas/w PEK2 #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2 .Screen/width DEI2 #00a0 SUB2 .Screen/x DEO2 ;font_hex .canvas/w LDZ2 #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
( draw ) #21 .Screen/color DEO ( draw ) #21 .Screen/color DEO
.Screen/x DEI2 8+ .Screen/x DEO2 ;font_hex .canvas/w PEK2 #0f AND #08 MUL ADD2 .Screen/addr DEO2 .Screen/x DEI2 8+ .Screen/x DEO2 ;font_hex .canvas/w LDZ2 #0f AND #08 MUL ADD2 .Screen/addr DEO2
( draw ) #21 .Screen/color DEO ( draw ) #21 .Screen/color DEO
( draw height ) ( draw height )
.Screen/x DEI2 8+ .Screen/x DEO2 ;font_hex .canvas/h PEK2 #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2 .Screen/x DEI2 8+ .Screen/x DEO2 ;font_hex .canvas/h LDZ2 #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
( draw ) #21 .Screen/color DEO ( draw ) #21 .Screen/color DEO
.Screen/x DEI2 8+ .Screen/x DEO2 ;font_hex .canvas/h PEK2 #0f AND #08 MUL ADD2 .Screen/addr DEO2 .Screen/x DEI2 8+ .Screen/x DEO2 ;font_hex .canvas/h LDZ2 #0f AND #08 MUL ADD2 .Screen/addr DEO2
( draw ) #21 .Screen/color DEO ( draw ) #21 .Screen/color DEO
&skip-size &skip-size
( draw save/load/guides icons ) ( draw save/load/guides icons )
.Screen/height DEI2 #0010 SUB2 .Screen/y DEO2 .Screen/height DEI2 #0010 SUB2 .Screen/y DEO2
.Screen/width DEI2 #0028 SUB2 .Screen/x DEO2 .Screen/width DEI2 #0028 SUB2 .Screen/x DEO2
;eye_icn #00 .document/presentation PEK #08 MUL ADD2 .Screen/addr DEO2 ;eye_icn #00 .document/presentation LDZ #08 MUL ADD2 .Screen/addr DEO2
#23 .Screen/color DEO #23 .Screen/color DEO
.Screen/x DEI2 8+ .Screen/x DEO2 .Screen/x DEI2 8+ .Screen/x DEO2
;filestate_icn .Screen/addr DEO2 ;filestate_icn .Screen/addr DEO2
@ -809,20 +809,20 @@ RTN
@line-rect ( x1 y1 x2 y2 color -- ) @line-rect ( x1 y1 x2 y2 color -- )
( load ) .color POK DUP2 STH2 .rect/y2 POK2 .rect/x2 POK2 DUP2 STH2 .rect/y1 POK2 .rect/x1 POK2 ( load ) .color STZ DUP2 STH2 .rect/y2 STZ2 .rect/x2 STZ2 DUP2 STH2 .rect/y1 STZ2 .rect/x1 STZ2
STH2r STH2r STH2r STH2r
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK DUP .Screen/color DEO ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .Screen/color DEO ( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/color DEO
( incr ) SWP2 ++ SWP2 ( incr ) SWP2 ++ SWP2
OVR2 OVR2 LTS2 ,&ver JCN OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2 POP2 POP2
.rect/x1 PEK2 .rect/x2 PEK2 .rect/x1 LDZ2 .rect/x2 LDZ2
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK DUP .Screen/color DEO ( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .Screen/color DEO ( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/color DEO
( incr ) SWP2 ++ SWP2 ( incr ) SWP2 ++ SWP2
OVR2 OVR2 ++ LTS2 ,&hor JCN OVR2 OVR2 ++ LTS2 ,&hor JCN
POP2 POP2 POP2 POP2
@ -831,14 +831,14 @@ RTN
@fill-rect ( x1 y1 x2 y2 color -- ) @fill-rect ( x1 y1 x2 y2 color -- )
.color POK .color STZ
( x1 x2 y1 y2 ) ROT2 SWP2 ( x1 x2 y1 y2 ) ROT2 SWP2
&ver &ver
( save ) OVR2 .Screen/y DEO2 ( save ) OVR2 .Screen/y DEO2
STH2 STH2 OVR2 OVR2 STH2 STH2 OVR2 OVR2
&hor &hor
( save ) OVR2 .Screen/x DEO2 ( save ) OVR2 .Screen/x DEO2
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
( incr ) SWP2 ++ SWP2 ( incr ) SWP2 ++ SWP2
OVR2 OVR2 LTS2 ,&hor JCN OVR2 OVR2 LTS2 ,&hor JCN
POP2 POP2 STH2r STH2r POP2 POP2 STH2r STH2r
@ -850,10 +850,10 @@ RTN
@draw-label ( addr color -- ) @draw-label ( addr color -- )
.color POK .color STZ
&loop &loop
DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
( draw ) .color PEK #20 ADD .Screen/color DEO ( draw ) .color LDZ #20 ADD .Screen/color DEO
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2 ( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
( loop ) DUP2 LDA #00 NEQ ,&loop JCN ( loop ) DUP2 LDA #00 NEQ ,&loop JCN
@ -863,9 +863,9 @@ RTN
@line-horizontal-dotted ( x0 x1 y color -- ) @line-horizontal-dotted ( x0 x1 y color -- )
.color POK .Screen/y DEO2 OVR2 .Screen/x DEO2 .color STZ .Screen/y DEO2 OVR2 .Screen/x DEO2
&draw-hor &draw-hor
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
( incr ) SWP2 #0002 ADD2 DUP2 .Screen/x DEO2 SWP2 ( incr ) SWP2 #0002 ADD2 DUP2 .Screen/x DEO2 SWP2
OVR2 OVR2 LTH2 ,&draw-hor JCN OVR2 OVR2 LTH2 ,&draw-hor JCN
POP2 POP2 POP2 POP2
@ -874,9 +874,9 @@ RTN
@line-vertical-dotted ( x y0 y1 color -- ) @line-vertical-dotted ( x y0 y1 color -- )
.color POK STH2 SWP2 .Screen/x DEO2 STH2r OVR2 .Screen/y DEO2 .color STZ STH2 SWP2 .Screen/x DEO2 STH2r OVR2 .Screen/y DEO2
&draw-ver &draw-ver
( draw ) .color PEK .Screen/color DEO ( draw ) .color LDZ .Screen/color DEO
( incr ) SWP2 #0002 ADD2 DUP2 .Screen/y DEO2 SWP2 ( incr ) SWP2 #0002 ADD2 DUP2 .Screen/y DEO2 SWP2
OVR2 OVR2 LTH2 ,&draw-ver JCN OVR2 OVR2 LTH2 ,&draw-ver JCN
POP2 POP2 POP2 POP2

View File

@ -24,7 +24,7 @@
%LDA-CHAR { #24 MOD #00 SWP ;b36clc ADD2 LDA } ( b36 -- char ) %LDA-CHAR { #24 MOD #00 SWP ;b36clc ADD2 LDA } ( b36 -- char )
%LDA-VALUE { #20 SUB #00 SWP ;values ADD2 LDA } ( char -- b36 ) %LDA-VALUE { #20 SUB #00 SWP ;values ADD2 LDA } ( char -- b36 )
%LDA-INDEX { #00 SWP #00 .grid/width PEK MUL2 ROT #00 SWP ADD2 } ( x y -- index ) %LDA-INDEX { #00 SWP #00 .grid/width LDZ MUL2 ROT #00 SWP ADD2 } ( x y -- index )
%LDA-CELL { LDA-INDEX DATA-CELLS ADD2 LDA } ( x y -- char ) %LDA-CELL { LDA-INDEX DATA-CELLS ADD2 LDA } ( x y -- char )
%SET-CELL { ROT ROT LDA-INDEX DATA-CELLS ADD2 STA } ( x y char -- ) %SET-CELL { ROT ROT LDA-INDEX DATA-CELLS ADD2 STA } ( x y char -- )
%LDA-TYPE { LDA-INDEX DATA-TYPES ADD2 LDA } ( x y -- type ) %LDA-TYPE { LDA-INDEX DATA-TYPES ADD2 LDA } ( x y -- type )
@ -59,8 +59,8 @@
( vectors ) ;on-frame .Screen/vector DEO2 ( vectors ) ;on-frame .Screen/vector DEO2
( find size ) ( find size )
.Screen/width DEI2 8/ SWP POP .grid/width POK .Screen/width DEI2 8/ SWP POP .grid/width STZ
.Screen/height DEI2 8/ SWP POP #02 SUB .grid/height POK .Screen/height DEI2 8/ SWP POP #02 SUB .grid/height STZ
( fill grid with dots ) ( fill grid with dots )
@ -71,47 +71,47 @@ BRK
@on-frame @on-frame
.timer PEK ++ DUP .timer POK .timer LDZ ++ DUP .timer STZ
( skip ) #08 EQU ,&tick JCN BRK &tick ( skip ) #08 EQU ,&tick JCN BRK &tick
.timer/frame PEK ++ .timer/frame POK .timer/frame LDZ ++ .timer/frame STZ
;run JSR2 ;run JSR2
#00 .timer POK #00 .timer STZ
BRK BRK
@on-button @on-button
.Controller/key DEI #00 EQU ,&no-key JCN .Controller/key DEI #00 EQU ,&no-key JCN
.selection/x1 PEK .selection/y1 PEK .Controller/key DEI SET-CELL .selection/x1 LDZ .selection/y1 LDZ .Controller/key DEI SET-CELL
;redraw JSR2 ;redraw JSR2
&no-key &no-key
( arrows ) ( arrows )
.Controller/button DEI #f0 AND .Controller/button DEI #f0 AND
DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN
.selection/y1 PEK #00 EQU ,&no-up JCN .selection/y1 LDZ #00 EQU ,&no-up JCN
.selection/y1 PEK -- .selection/y1 POK .selection/y1 LDZ -- .selection/y1 STZ
.selection/y2 PEK -- .selection/y2 POK &no-up .selection/y2 LDZ -- .selection/y2 STZ &no-up
DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN
.selection/y1 PEK .grid/height PEK -- EQU ,&no-down JCN .selection/y1 LDZ .grid/height LDZ -- EQU ,&no-down JCN
.selection/y1 PEK ++ .selection/y1 POK .selection/y1 LDZ ++ .selection/y1 STZ
.selection/y2 PEK ++ .selection/y2 POK &no-down .selection/y2 LDZ ++ .selection/y2 STZ &no-down
DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN
.selection/x1 PEK #00 EQU ,&no-left JCN .selection/x1 LDZ #00 EQU ,&no-left JCN
.selection/x1 PEK -- .selection/x1 POK .selection/x1 LDZ -- .selection/x1 STZ
.selection/x2 PEK -- .selection/x2 POK &no-left .selection/x2 LDZ -- .selection/x2 STZ &no-left
DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN
.selection/x1 PEK .grid/width PEK -- EQU ,&no-right JCN .selection/x1 LDZ .grid/width LDZ -- EQU ,&no-right JCN
.selection/x1 PEK ++ .selection/x1 POK .selection/x1 LDZ ++ .selection/x1 STZ
.selection/x2 PEK ++ .selection/x2 POK &no-right .selection/x2 LDZ ++ .selection/x2 STZ &no-right
POP POP
.Controller/key DEI #08 NEQ ,&no-backspace JCN .Controller/key DEI #08 NEQ ,&no-backspace JCN
.selection/x1 PEK .selection/y1 PEK #2e SET-CELL ( put . char ) .selection/x1 LDZ .selection/y1 LDZ #2e SET-CELL ( put . char )
&no-backspace &no-backspace
;redraw JSR2 ;redraw JSR2
@ -121,24 +121,24 @@ BRK
@on-mouse @on-mouse
.Mouse/state DEI #00 EQU ,&no-touch JCN .Mouse/state DEI #00 EQU ,&no-touch JCN
.Mouse/x DEI2 8/ SWP POP .selection/x1 POK .Mouse/x DEI2 8/ SWP POP .selection/x1 STZ
.Mouse/y DEI2 8/ SWP POP .selection/y1 POK .Mouse/y DEI2 8/ SWP POP .selection/y1 STZ
;redraw JSR2 ;redraw JSR2
&no-touch &no-touch
( clear last cursor ) ( clear last cursor )
.cursor/x PEK2 .Screen/x DEO2 .cursor/x LDZ2 .Screen/x DEO2
.cursor/y PEK2 .Screen/y DEO2 .cursor/y LDZ2 .Screen/y DEO2
;blank_icn .Screen/addr DEO2 ;blank_icn .Screen/addr DEO2
#30 .Screen/color DEO #30 .Screen/color DEO
( record cursor positions ) ( record cursor positions )
.Mouse/x DEI2 .cursor/x POK2 .Mouse/x DEI2 .cursor/x STZ2
.Mouse/y DEI2 .cursor/y POK2 .Mouse/y DEI2 .cursor/y STZ2
( draw new cursor ) ( draw new cursor )
.cursor/x PEK2 .Screen/x DEO2 .cursor/x LDZ2 .Screen/x DEO2
.cursor/y PEK2 .Screen/y DEO2 .cursor/y LDZ2 .Screen/y DEO2
;cursor_icn .Screen/addr DEO2 ;cursor_icn .Screen/addr DEO2
#32 .Mouse/state DEI #01 EQU ADD .Screen/color DEO #32 .Mouse/state DEI #01 EQU ADD .Screen/color DEO
@ -146,9 +146,9 @@ BRK
@start ( -- ) @start ( -- )
#00 .grid/height PEK #00 .grid/height LDZ
&ver &ver
#00 .grid/width PEK #00 .grid/width LDZ
&hor &hor
( get x,y ) SWP2 OVR STH SWP2 OVR STHr ( get x,y ) SWP2 OVR STH SWP2 OVR STHr
#2e SET-CELL #2e SET-CELL
@ -159,7 +159,7 @@ BRK
DUP2 LTH ,&ver JCN DUP2 LTH ,&ver JCN
POP2 POP2
#9a .timer/speed POK #9a .timer/speed STZ
RTN RTN
@ -172,7 +172,7 @@ RTN
@is-selected ( x y -- flag ) @is-selected ( x y -- flag )
.selection/x1 PEK .selection/y1 PEK EQU2 .selection/x1 LDZ .selection/y1 LDZ EQU2
RTN RTN
@ -236,7 +236,7 @@ RTN
POP POP
++ ++
#30 .timer/frame PEK #08 MOD ADD SET-CELL #30 .timer/frame LDZ #08 MOD ADD SET-CELL
RTN RTN
@ -445,9 +445,9 @@ RTN
@init ( -- ) @init ( -- )
#00 .grid/height PEK #00 .grid/height LDZ
&ver &ver
#00 .grid/width PEK #00 .grid/width LDZ
&hor &hor
( get x,y ) SWP2 OVR STH SWP2 OVR STHr ( get x,y ) SWP2 OVR STH SWP2 OVR STHr
( unlock ) #00 SET-LOCK ( unlock ) #00 SET-LOCK
@ -464,9 +464,9 @@ RTN
;init JSR2 ;init JSR2
#00 .grid/height PEK #00 .grid/height LDZ
&ver &ver
#00 .grid/width PEK #00 .grid/width LDZ
&hor &hor
( get x,y ) SWP2 OVR STH SWP2 OVR STHr ( get x,y ) SWP2 OVR STH SWP2 OVR STHr
DUP2 LDA-CELL ;run-char JSR2 DUP2 LDA-CELL ;run-char JSR2
@ -486,7 +486,7 @@ RTN
( Positionx ) ( Positionx )
#0000 .Screen/x DEO2 #0000 .Screen/x DEO2
.selection/x1 PEK .selection/x1 LDZ
DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
#22 .Screen/color DEO #22 .Screen/color DEO
#0008 .Screen/x DEO2 #0008 .Screen/x DEO2
@ -495,7 +495,7 @@ RTN
( Positiony ) ( Positiony )
#0010 .Screen/x DEO2 #0010 .Screen/x DEO2
.selection/y1 PEK .selection/y1 LDZ
DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
#22 .Screen/color DEO #22 .Screen/color DEO
#0018 .Screen/x DEO2 #0018 .Screen/x DEO2
@ -508,7 +508,7 @@ RTN
( Frame ) ( Frame )
#0030 .Screen/x DEO2 #0030 .Screen/x DEO2
.timer/frame PEK .timer/frame LDZ
DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
#22 .Screen/color DEO #22 .Screen/color DEO
#0038 .Screen/x DEO2 #0038 .Screen/x DEO2
@ -517,11 +517,11 @@ RTN
#0040 .Screen/x DEO2 #0040 .Screen/x DEO2
;beat_icn .Screen/addr DEO2 ;beat_icn .Screen/addr DEO2
#21 .timer/frame PEK #08 MOD #00 EQU #02 MUL ADD .Screen/color DEO #21 .timer/frame LDZ #08 MOD #00 EQU #02 MUL ADD .Screen/color DEO
( Speed ) ( Speed )
#0050 .Screen/x DEO2 #0050 .Screen/x DEO2
.timer/speed PEK .timer/speed LDZ
DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
#22 .Screen/color DEO #22 .Screen/color DEO
#0058 .Screen/x DEO2 #0058 .Screen/x DEO2
@ -541,10 +541,10 @@ RTN
@redraw ( -- ) @redraw ( -- )
#00 .grid/height PEK #00 .grid/height LDZ
&ver &ver
( pos-y ) OVR #00 SWP #0008 MUL2 .Screen/y DEO2 ( pos-y ) OVR #00 SWP #0008 MUL2 .Screen/y DEO2
#00 .grid/width PEK #00 .grid/width LDZ
&hor &hor
( pos-x ) OVR #00 SWP #0008 MUL2 .Screen/x DEO2 ( pos-x ) OVR #00 SWP #0008 MUL2 .Screen/x DEO2
( get x,y ) SWP2 OVR STH SWP2 OVR STHr ( get x,y ) SWP2 OVR STH SWP2 OVR STHr

View File

@ -42,7 +42,7 @@ Program p;
char ops[][4] = { char ops[][4] = {
"BRK", "LIT", "NOP", "POP", "DUP", "SWP", "OVR", "ROT", "BRK", "LIT", "NOP", "POP", "DUP", "SWP", "OVR", "ROT",
"EQU", "NEQ", "GTH", "LTH", "JMP", "JCN", "JSR", "STH", "EQU", "NEQ", "GTH", "LTH", "JMP", "JCN", "JSR", "STH",
"PEK", "POK", "LDR", "STR", "LDA", "STA", "DEI", "DEO", "LDZ", "STZ", "LDR", "STR", "LDA", "STA", "DEI", "DEO",
"ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT" "ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT"
}; };