(piano.tal) Rewrite

This commit is contained in:
Devine Lu Linvega 2023-02-26 20:16:41 -08:00
parent 91386f4832
commit 5d9dc11ec5
1 changed files with 199 additions and 217 deletions

View File

@ -12,16 +12,11 @@
@last-note $1 @last-note $1
@octave $1 @octave $1
@pointer @pointer &x $2 &y $2
&x $2 &y $2 @center &x $2 &y $2
@center @adsr-view &x1 $2 &y1 $2 &x2 $2 &y2 $2
&x $2 &y $2 @wave-view &x1 $2 &y1 $2 &x2 $2 &y2 $2
@adsr-view @octave-view &x1 $2 &y1 $2 &x2 $2 &y2 $2
&x1 $2 &y1 $2 &x2 $2 &y2 $2
@wave-view
&x1 $2 &y1 $2 &x2 $2 &y2 $2
@octave-view
&x1 $2 &y1 $2 &x2 $2 &y2 $2
|0100 ( -> ) |0100 ( -> )
@ -29,14 +24,9 @@
#0fe5 .System/r DEO2 #0fe5 .System/r DEO2
#0fc5 .System/g DEO2 #0fc5 .System/g DEO2
#0f25 .System/b DEO2 #0f25 .System/b DEO2
( vectors )
;on-frame .Screen/vector DEO2
;on-control .Controller/vector DEO2
;on-mouse .Mouse/vector DEO2
;on-message .Console/vector DEO2
( find center ) ( find center )
.Screen/width DEI2 #01 SFT2 .center/x STZ2 .Screen/width DEI2 #01 SFT2 .center/x STZ2
.Screen/height DEI2 #01 SFT2 .center/y STZ2 .Screen/height DEI2 #01 SFT2 #0018 ADD2 .center/y STZ2
( place octave ) ( place octave )
.center/x LDZ2 #0080 SUB2 .octave-view/x1 STZ2 .center/x LDZ2 #0080 SUB2 .octave-view/x1 STZ2
.center/y LDZ2 #0008 ADD2 .octave-view/y1 STZ2 .center/y LDZ2 #0008 ADD2 .octave-view/y1 STZ2
@ -49,33 +39,37 @@
.adsr-view/y1 LDZ2 #0018 ADD2 .adsr-view/y2 STZ2 .adsr-view/y1 LDZ2 #0018 ADD2 .adsr-view/y2 STZ2
( place waveform ) ( place waveform )
.center/x LDZ2 #0080 SUB2 .wave-view/x1 STZ2 .center/x LDZ2 #0080 SUB2 .wave-view/x1 STZ2
.center/y LDZ2 #0020 SUB2 .wave-view/y1 STZ2 .center/y LDZ2 #0040 SUB2 .wave-view/y1 STZ2
.wave-view/x1 LDZ2 #0100 ADD2 .wave-view/x2 STZ2 .wave-view/x1 LDZ2 #0100 ADD2 .wave-view/x2 STZ2
.wave-view/y1 LDZ2 #0020 ADD2 .wave-view/y2 STZ2 .wave-view/y1 LDZ2 #0040 ADD2 .wave-view/y2 STZ2
( default settings )
#ff .last-note STZ
#041c .Audio0/adsr DEO2 #041c .Audio0/adsr DEO2
#dd .Audio0/volume DEO #dd .Audio0/volume DEO
;sin-pcm .Audio0/addr DEO2 ;sin-pcm .Audio0/addr DEO2
#0100 .Audio0/length DEO2 #0100 .Audio0/length DEO2
( inital drawing ) ( inital drawing )
;draw-octave JSR2 draw-octave
;draw-adsr JSR2 draw-adsr
;draw-wave JSR2 draw-wave
( unlock )
;on-frame .Screen/vector DEO2
;on-control .Controller/vector DEO2
;on-mouse .Mouse/vector DEO2
;on-message .Console/vector DEO2
BRK BRK
@on-frame ( -> ) @on-frame ( -> )
#00 .Screen/auto DEO
.adsr-view/y2 LDZ2 #0020 SUB2 .Screen/y DEO2 .adsr-view/y2 LDZ2 #0020 SUB2 .Screen/y DEO2
#10 #00 #1000
&loop &loop
.adsr-view/x2 LDZ2 #003a SUB2 .Screen/x DEO2 .adsr-view/x2 LDZ2 #003a SUB2 .Screen/x DEO2
#10 OVR SUB .Audio0/output DEI #0f AND LTH .Screen/pixel DEO #10 OVR SUB .Audio0/output DEI #0f AND LTH .Screen/pixel DEO
.adsr-view/x2 LDZ2 #003a SUB2 INC2 INC2 .Screen/x DEO2 .adsr-view/x2 LDZ2 #003a SUB2 INC2 INC2 .Screen/x DEO2
#10 OVR SUB .Audio0/output DEI #04 SFT LTH .Screen/pixel DEO #10 OVR SUB .Audio0/output DEI #04 SFT LTH .Screen/pixel DEO
.Screen/y DEI2k INC2 INC2 ROT DEO2 .Screen/y DEI2k INC2 INC2 ROT DEO2
INC GTHk ,&loop JCN INC GTHk ?&loop
POP2 POP2
BRK BRK
@ -88,92 +82,95 @@ BRK
#40 .Screen/sprite DEO #40 .Screen/sprite DEO
.Controller/key DEI .Controller/key DEI
[ LIT "a ] NEQk NIP ,&no-c JCN #30 .octave LDZ #0c MUL ADD ;play JSR2 &no-c [ LIT "a ] NEQk NIP ?&no-c #30 .octave LDZ #0c MUL ADD play &no-c
[ LIT "s ] NEQk NIP ,&no-d JCN #32 .octave LDZ #0c MUL ADD ;play JSR2 &no-d [ LIT "s ] NEQk NIP ?&no-d #32 .octave LDZ #0c MUL ADD play &no-d
[ LIT "d ] NEQk NIP ,&no-e JCN #34 .octave LDZ #0c MUL ADD ;play JSR2 &no-e [ LIT "d ] NEQk NIP ?&no-e #34 .octave LDZ #0c MUL ADD play &no-e
[ LIT "f ] NEQk NIP ,&no-f JCN #35 .octave LDZ #0c MUL ADD ;play JSR2 &no-f [ LIT "f ] NEQk NIP ?&no-f #35 .octave LDZ #0c MUL ADD play &no-f
[ LIT "g ] NEQk NIP ,&no-g JCN #37 .octave LDZ #0c MUL ADD ;play JSR2 &no-g [ LIT "g ] NEQk NIP ?&no-g #37 .octave LDZ #0c MUL ADD play &no-g
[ LIT "h ] NEQk NIP ,&no-a JCN #39 .octave LDZ #0c MUL ADD ;play JSR2 &no-a [ LIT "h ] NEQk NIP ?&no-a #39 .octave LDZ #0c MUL ADD play &no-a
[ LIT "j ] NEQk NIP ,&no-b JCN #3b .octave LDZ #0c MUL ADD ;play JSR2 &no-b [ LIT "j ] NEQk NIP ?&no-b #3b .octave LDZ #0c MUL ADD play &no-b
[ LIT "k ] NEQk NIP ,&no-c2 JCN #3c .octave LDZ #0c MUL ADD ;play JSR2 &no-c2 [ LIT "k ] NEQk NIP ?&no-c2 #3c .octave LDZ #0c MUL ADD play &no-c2
[ #1b ] NEQk NIP ,&no-esc JCN #010f DEO &no-esc [ #1b ] NEQk NIP ?&no-esc #010f DEO &no-esc
POP POP
( release ) ( release )
#00 .Controller/key DEO #00 .Controller/key DEO
.Controller/button DEI .Controller/button DEI
[ #11 ] NEQk NIP ,&cu JCN #3c ;play JSR2 &cu [ #11 ] NEQk NIP ?&cu #3c play &cu
[ #21 ] NEQk NIP ,&cd JCN #3d ;play JSR2 &cd [ #21 ] NEQk NIP ?&cd #3d play &cd
[ #41 ] NEQk NIP ,&cl JCN #3e ;play JSR2 &cl [ #41 ] NEQk NIP ?&cl #3e play &cl
[ #81 ] NEQk NIP ,&cr JCN #3f ;play JSR2 &cr [ #81 ] NEQk NIP ?&cr #3f play &cr
[ #12 ] NEQk NIP ,&au JCN #40 ;play JSR2 &au [ #12 ] NEQk NIP ?&au #40 play &au
[ #22 ] NEQk NIP ,&ad JCN #41 ;play JSR2 &ad [ #22 ] NEQk NIP ?&ad #41 play &ad
[ #42 ] NEQk NIP ,&al JCN #42 ;play JSR2 &al [ #42 ] NEQk NIP ?&al #42 play &al
[ #82 ] NEQk NIP ,&ar JCN #43 ;play JSR2 &ar [ #82 ] NEQk NIP ?&ar #43 play &ar
[ #14 ] NEQk NIP ,&su JCN #44 ;play JSR2 &su [ #14 ] NEQk NIP ?&su #44 play &su
[ #24 ] NEQk NIP ,&sd JCN #45 ;play JSR2 &sd [ #24 ] NEQk NIP ?&sd #45 play &sd
[ #44 ] NEQk NIP ,&sl JCN #46 ;play JSR2 &sl [ #44 ] NEQk NIP ?&sl #46 play &sl
[ #84 ] NEQk NIP ,&sr JCN #47 ;play JSR2 &sr [ #84 ] NEQk NIP ?&sr #47 play &sr
[ #40 ] NEQk NIP ,&l JCN .Audio0/addr DEI2 #0010 SUB2 .Audio0/addr DEO2 &l [ #40 ] NEQk NIP ?&l .Audio0/addr DEI2 #0010 SUB2 .Audio0/addr DEO2 &l
[ #80 ] NEQk NIP ,&r JCN .Audio0/addr DEI2 #0010 ADD2 .Audio0/addr DEO2 &r [ #80 ] NEQk NIP ?&r .Audio0/addr DEI2 #0010 ADD2 .Audio0/addr DEO2 &r
POP POP
;draw-octave JSR2 draw-octave
;draw-wave JSR2 draw-wave
BRK BRK
@on-message ( -> ) @on-message ( -> )
.Console/read DEI ;play JSR2 .Console/read DEI play
;draw-octave JSR2 draw-octave
BRK BRK
@on-mouse ( -> ) @on-mouse ( -> )
;draw-cursor JSR2 #00 .Mouse/state DEI NEQ #41 ADD ;cursor-icn update-cursor
.Mouse/state DEI #00 NEQ JMP [ BRK ] .Mouse/state DEI ?on-mouse-touch
.Mouse/x DEI2 .Mouse/y DEI2 .wave-view ;within-rect JSR2 BRK
;on-touch-wave-view JCN2
.Mouse/x DEI2 .Mouse/y DEI2 .adsr-view ;within-rect JSR2 @on-mouse-touch ( -> )
;on-touch-adsr-view JCN2
.Mouse/x DEI2 .Mouse/y DEI2 .octave-view ;within-rect JSR2 .Mouse/x DEI2 .Mouse/y DEI2 .wave-view within-rect
;on-touch-octave-view JCN2 ?on-touch-wave-view
.Mouse/x DEI2 .Mouse/y DEI2 .adsr-view within-rect
?on-touch-adsr-view
.Mouse/x DEI2 .Mouse/y DEI2 .octave-view within-rect
?on-touch-octave-view
BRK BRK
@on-touch-wave-view ( -> ) @on-touch-wave-view ( -> )
.Mouse/x DEI2 .wave-view/x1 LDZ2 SUB2 .Audio0/length DEO2 .Mouse/x DEI2 .wave-view/x1 LDZ2 SUB2 .Audio0/length DEO2
;draw-wave JSR2 draw-wave
;draw-cursor JSR2
BRK BRK
@on-touch-octave-view ( -> ) @on-touch-octave-view ( -> )
.Mouse/x DEI2 .octave-view/x1 LDZ2 SUB2 #03 SFT2 NIP #09 NEQ ,&no-mod JCN .Mouse/x DEI2 .octave-view/x1 LDZ2 SUB2 #03 SFT2 NIP #09 NEQ ?&no-mod
.Mouse/y DEI2 .octave-view/y1 LDZ2 SUB2 #03 SFT2 NIP .Mouse/y DEI2 .octave-view/y1 LDZ2 SUB2 #03 SFT2 NIP
[ #00 ] NEQk NIP ,&no-incr JCN [ #00 ] NEQk NIP ?&no-incr
.octave LDZ #03 EQU ,&no-incr JCN .octave LDZ #03 EQU ?&no-incr
.octave LDZ INC .octave STZ &no-incr .octave LDZ INC .octave STZ &no-incr
[ #02 ] NEQk NIP ,&no-decr JCN [ #02 ] NEQk NIP ?&no-decr
.octave LDZ #ff EQU ,&no-decr JCN .octave LDZ #ff EQU ?&no-decr
.octave LDZ #01 SUB .octave STZ &no-decr .octave LDZ #01 SUB .octave STZ &no-decr
POP POP
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-octave JSR2 draw-octave
BRK BRK
&no-mod &no-mod
.Mouse/x DEI2 .octave-view/x1 LDZ2 SUB2 #03 SFT2 NIP #06 GTH ,&no-key JCN .Mouse/x DEI2 .octave-view/x1 LDZ2 SUB2 #03 SFT2 NIP #06 GTH ?&no-key
.Mouse/x DEI2 .octave-view/x1 LDZ2 SUB2 #03 SFT2 ;notes ADD2 LDA .octave LDZ #0c MUL ADD ;play JSR2 .Mouse/x DEI2 .octave-view/x1 LDZ2 SUB2 #03 SFT2 ;notes-lut ADD2 LDA .octave LDZ #0c MUL ADD play
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-octave JSR2 draw-octave
&no-key &no-key
BRK BRK
@ -181,80 +178,81 @@ BRK
@on-touch-adsr-view ( -> ) @on-touch-adsr-view ( -> )
.Mouse/x DEI2 .adsr-view/x1 LDZ2 SUB2 #03 SFT2 NIP #03 DIV .Mouse/x DEI2 .adsr-view/x1 LDZ2 SUB2 #03 SFT2 NIP #03 DIV
[ #00 ] NEQk NIP ,&no-a JCN [ #00 ] NEQk NIP ?&no-a
.Audio0/adsr DEI ,&touch2 JSR .Audio0/adsr DEO &no-a .Audio0/adsr DEI touch2 .Audio0/adsr DEO &no-a
[ #01 ] NEQk NIP ,&no-d JCN [ #01 ] NEQk NIP ?&no-d
.Audio0/adsr DEI ,&touch JSR .Audio0/adsr DEO &no-d .Audio0/adsr DEI touch .Audio0/adsr DEO &no-d
[ #02 ] NEQk NIP ,&no-s JCN [ #02 ] NEQk NIP ?&no-s
.Audio0/adsr INC DEI ,&touch2 JSR .Audio0/adsr INC DEO &no-s .Audio0/adsr INC DEI touch2 .Audio0/adsr INC DEO &no-s
[ #03 ] NEQk NIP ,&no-r JCN [ #03 ] NEQk NIP ?&no-r
.Audio0/adsr INC DEI ,&touch JSR .Audio0/adsr INC DEO &no-r .Audio0/adsr INC DEI touch .Audio0/adsr INC DEO &no-r
[ #05 ] NEQk NIP ,&no-left JCN [ #05 ] NEQk NIP ?&no-left
.Audio0/volume DEI ,&touch2 JSR .Audio0/volume DEO &no-left .Audio0/volume DEI touch2 .Audio0/volume DEO &no-left
[ #06 ] NEQk NIP ,&no-right JCN [ #06 ] NEQk NIP ?&no-right
.Audio0/volume DEI ,&touch JSR .Audio0/volume DEO &no-right .Audio0/volume DEI touch .Audio0/volume DEO &no-right
POP POP
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-adsr JSR2 draw-adsr
;draw-cursor JSR2
BRK BRK
&touch DUP #f0 AND STH #01 .Mouse/state DEI #01 GTH #0e MUL ADD ADD #0f AND STHr ADD JMP2r @touch
&touch2 #10 .Mouse/state DEI #01 GTH #e0 MUL ADD ADD JMP2r DUP #f0 AND STH #01 .Mouse/state DEI #01 GTH #0e MUL ADD ADD #0f AND STHr ADD JMP2r
@touch2
#10 .Mouse/state DEI #01 GTH #e0 MUL ADD ADD JMP2r
(
@|core )
@play ( pitch -- ) @play ( pitch -- )
DUP #0c ( mod ) [ DIVk MUL SUB ] .last-note STZ DUP #0c DIVk MUL SUB ;draw-octave/last STA
.Audio0/pitch DEO .Audio0/pitch DEO
JMP2r JMP2r
@draw-cursor ( -- ) @update-cursor ( color addr* -- )
( clear last cursor ) [ LIT2 00 -Screen/auto ] DEO
;cursor .Screen/addr DEO2 #40 draw-cursor
.pointer/x LDZ2 .Screen/x DEO2 .Mouse/x DEI2 ,draw-cursor/x STR2
.pointer/y LDZ2 .Screen/y DEO2 .Mouse/y DEI2 ,draw-cursor/y STR2
#40 .Screen/sprite DEO .Screen/addr DEO2
( record pointer positions )
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 @draw-cursor ( color -- )
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
( colorize on state ) [ LIT2 &x $2 ] .Screen/x DEO2
#41 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/sprite DEO [ LIT2 &y $2 ] .Screen/y DEO2
.Screen/sprite DEO
JMP2r JMP2r
@draw-octave ( -- ) @draw-octave ( -- )
( arrows )
[ LIT2 02 -Screen/auto ] DEO
.octave-view/x1 LDZ2 #0048 ADD2 .Screen/x DEO2 .octave-view/x1 LDZ2 #0048 ADD2 .Screen/x DEO2
;arrow-icns .Screen/addr DEO2
.octave-view/y1 LDZ2 .Screen/y DEO2 .octave-view/y1 LDZ2 .Screen/y DEO2
#01 .Screen/sprite DEO ;arrow-icns .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEO
;arrow-icns/down .Screen/addr DEO2
.octave-view/y1 LDZ2 #0010 ADD2 .Screen/y DEO2
#01 .Screen/sprite DEO
;font-hex .octave LDZ #03 ADD #00 SWP #30 SFT2 ADD2 .Screen/addr DEO2 ;font-hex .octave LDZ #03 ADD #00 SWP #30 SFT2 ADD2 .Screen/addr DEO2
.octave-view/y1 LDZ2 #0008 ADD2 .Screen/y DEO2 [ LIT2 03 -Screen/sprite ] DEO
#03 .Screen/sprite DEO ;arrow-icns/down .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEO
( octave )
.octave-view/x1 LDZ2 .Screen/x DEO2 .octave-view/x1 LDZ2 .Screen/x DEO2
.octave-view/y1 LDZ2 .Screen/y DEO2 .octave-view/y1 LDZ2 .Screen/y DEO2
#06 .Screen/auto DEO [ LIT2 06 -Screen/auto ] DEO
.last-note LDZ STH [ LITr &last ff ]
;keys-left-icns STHkr #00 EQU INC ,draw-key JSR ;keys-left-icns STHkr #00 EQU INC draw-key
;keys-middle-icns STHkr #02 EQU INC ,draw-key JSR ;keys-middle-icns STHkr #02 EQU INC draw-key
;keys-right-icns STHkr #04 EQU INC ,draw-key JSR ;keys-right-icns STHkr #04 EQU INC draw-key
;keys-left-icns STHkr #05 EQU INC ,draw-key JSR ;keys-left-icns STHkr #05 EQU INC draw-key
;keys-middle-icns STHkr #07 EQU INC ,draw-key JSR ;keys-middle-icns STHkr #07 EQU INC draw-key
;keys-middle-icns STHkr #09 EQU INC ,draw-key JSR ;keys-middle-icns STHkr #09 EQU INC draw-key
;keys-right-icns STHr #0b EQU INC ,draw-key JSR ;keys-right-icns STHr #0b EQU INC
#00 .Screen/auto DEO
JMP2r ( >> )
@draw-key ( addr* color -- ) @draw-key ( addr* color -- )
@ -271,58 +269,44 @@ JMP2r
( adsr ) ( adsr )
.adsr-view/x1 LDZ2 .adsr-view/y1 LDZ2 .adsr-view/x1 LDZ2 .adsr-view/y1 LDZ2
.Audio0/adsr DEI #04 SFT .Audio0/adsr DEI #04 SFT draw-knob
;draw-knob JSR2
.adsr-view/x1 LDZ2 #0018 ADD2 .adsr-view/y1 LDZ2 .adsr-view/x1 LDZ2 #0018 ADD2 .adsr-view/y1 LDZ2
.Audio0/adsr DEI #0f AND .Audio0/adsr DEI #0f AND draw-knob
;draw-knob JSR2
.adsr-view/x1 LDZ2 #0030 ADD2 .adsr-view/y1 LDZ2 .adsr-view/x1 LDZ2 #0030 ADD2 .adsr-view/y1 LDZ2
.Audio0/adsr INC DEI #04 SFT .Audio0/adsr INC DEI #04 SFT draw-knob
;draw-knob JSR2
.adsr-view/x1 LDZ2 #0048 ADD2 .adsr-view/y1 LDZ2 .adsr-view/x1 LDZ2 #0048 ADD2 .adsr-view/y1 LDZ2
.Audio0/adsr INC DEI #0f AND .Audio0/adsr INC DEI #0f AND draw-knob
;draw-knob JSR2
( volume ) ( volume )
.adsr-view/x2 LDZ2 #0028 SUB2 .adsr-view/y1 LDZ2 .adsr-view/x2 LDZ2 #0028 SUB2 .adsr-view/y1 LDZ2
.Audio0/volume DEI #04 SFT .Audio0/volume DEI #04 SFT draw-knob
;draw-knob JSR2
.adsr-view/x2 LDZ2 #0010 SUB2 .adsr-view/y1 LDZ2 .adsr-view/x2 LDZ2 #0010 SUB2 .adsr-view/y1 LDZ2
.Audio0/volume DEI #0f AND .Audio0/volume DEI #0f AND
;draw-knob JSR2
JMP2r !draw-knob
@draw-wave ( -- ) @draw-wave ( -- )
#01 ;draw-wave-length JSR2 ( #01 draw-wave-length )
( dotted zero )
.wave-view/x1 LDZ2 .Screen/x DEO2 .wave-view/x1 LDZ2 .Screen/x DEO2
( waveform ) ( waveform )
#ff #00 [ LIT2 01 -Screen/auto ] DEO
;sin-pcm/end ;sin-pcm
&loop &loop
( dotted line ) LDAk #00 SWP #02 SFT2 .wave-view/y1 LDZ2 ADD2 .Screen/y DEO2
DUP #01 AND ,&no-dot JCN ( draw ) DUP2 ;sin-pcm SUB2 NIP .Audio0/length DEI2 NIP GTH INC INC .Screen/pixel DEO
.wave-view/y1 LDZ2 #0010 ADD2 .Screen/y DEO2 INC2 GTH2k ?&loop
#03 .Screen/pixel DEO POP2 POP2
&no-dot
#00 OVR .Audio0/addr DEI2 ADD2 LDA
#01 SFT
#00 SWP #02 SFT2 .wave-view/y1 LDZ2 ADD2 .Screen/y DEO2
.Screen/x DEI2 INC2 .Screen/x DEO2
( draw ) DUP
.Audio0/length DEI2 NIP GTH
.Audio0/length DEI2 #0100 NEQ2 AND DUP ADD INC .Screen/pixel DEO
INC GTHk ,&loop JCN
POP2
( range ) ( range )
#01 .Screen/auto DEO #01 .Screen/auto DEO
.wave-view/x1 LDZ2 .Screen/x DEO2 .wave-view/x1 LDZ2 .Screen/x DEO2
.wave-view/y1 LDZ2 #0010 SUB2 .Screen/y DEO2 .wave-view/y1 LDZ2 #0010 SUB2 .Screen/y DEO2
.Audio0/addr DEI2 ;draw-short JSR2 .Audio0/addr DEI2 draw-short
.wave-view/x2 LDZ2 #0020 SUB2 .Screen/x DEO2 .wave-view/x2 LDZ2 #0020 SUB2 .Screen/x DEO2
.Audio0/length DEI2 ;draw-short JSR2 .Audio0/length DEI2 draw-short
#00 .Screen/auto DEO #00 .Screen/auto DEO
JMP2r JMP2r
@ -345,7 +329,7 @@ JMP2r
&loop &loop
DUP2 .Screen/y DEO2 DUP2 .Screen/y DEO2
( draw ) STHkr .Screen/pixel DEO ( draw ) STHkr .Screen/pixel DEO
INC2 GTH2k ,&loop JCN INC2 GTH2k ?&loop
POP2 POP2 POP2 POP2
POPr POPr
@ -358,45 +342,45 @@ JMP2r
OVR2 OVR2 .Screen/y DEO2 .Screen/x DEO2 OVR2 OVR2 .Screen/y DEO2 .Screen/x DEO2
( circle ) ( circle )
;knob-icns .Screen/addr DEO2 ;knob-icns .Screen/addr DEO2
#16 .Screen/auto DEO [ LIT2 16 -Screen/auto ] DEO
#01 .Screen/sprite DEOk DEO [ LIT2 01 -Screen/sprite ] DEOk DEO
#00 .Screen/auto DEO
( value ) ( value )
#0010 ADD2 .Screen/y DEO2 #0010 ADD2 .Screen/y DEO2
#0004 ADD2 .Screen/x DEO2 #0004 ADD2 .Screen/x DEO2
;font-hex #00 STHkr #30 SFT ADD2 .Screen/addr DEO2 ;font-hex #00 STHkr #30 SFT ADD2 .Screen/addr DEO2
#01 .Screen/sprite DEO [ LIT2 00 -Screen/auto ] DEO
[ LIT2 01 -Screen/sprite ] DEO
( marker ) ( marker )
.Screen/x DEI2 #0004 SUB2 #00 #00 STHkr ;knob-offsetx ADD2 LDA ADD2 .Screen/x DEO2 .Screen/x DEI2 #0004 SUB2 #0000 STHkr ;knob-offsetx ADD2 LDA ADD2 .Screen/x DEO2
.Screen/y DEI2 #0010 SUB2 #00 #00 STHr ;knob-offsety ADD2 LDA ADD2 .Screen/y DEO2 .Screen/y DEI2 #0010 SUB2 #0000 STHr ;knob-offsety ADD2 LDA ADD2 .Screen/y DEO2
;knob-icns #0020 ADD2 .Screen/addr DEO2 ;knob-icns #0020 ADD2 .Screen/addr DEO2
#05 .Screen/sprite DEO [ LIT2 05 -Screen/sprite ] DEO
JMP2r JMP2r
@draw-short ( short* -- ) @draw-short ( short* -- )
SWP ,draw-byte JSR SWP draw-byte
@draw-byte ( byte -- ) @draw-byte ( byte -- )
DUP #04 SFT ,draw-hex JSR #0f AND DUP #04 SFT draw-hex #0f AND
@draw-hex ( char -- ) @draw-hex ( char -- )
#00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2 #00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2
#02 .Screen/sprite DEO [ LIT2 02 -Screen/sprite ] DEO
JMP2r JMP2r
@within-rect ( x* y* rect -- flag ) @within-rect ( x* y* rect -- flag )
STH STH
( y < rect.y1 ) DUP2 STHkr INC INC LDZ2 LTH2 ,&skip JCN ( y < rect.y1 ) DUP2 STHkr INC INC LDZ2 LTH2 ?&skip
( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ,&skip JCN ( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ?&skip
SWP2 SWP2
( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN ( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ?&skip
( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN ( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ?&skip
POP2 POP2 POPr POP2 POP2 POPr
#01 #01
JMP2r JMP2r
@ -406,49 +390,47 @@ JMP2r
JMP2r JMP2r
@cursor @phex ( short* -- ) SWP phex/b &b DUP #04 SFT phex/c &c #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO JMP2r
80c0 e0f0 f8e0 1000
@arrow-icns (
@|assets )
@cursor-icn [
80c0 e0f0 f8e0 1000 ]
@arrow-icns [
0010 387c fe10 1000 0010 387c fe10 1000
&down &down
0010 1010 fe7c 3810 0010 1010 fe7c 3810 ]
@notes-lut [
@notes
30 32 34 35 30 32 34 35
37 39 3b 3c 37 39 3b 3c ]
@keys-left-icns [
@keys-left-icns
7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7e7f 7c7c 7c7c 7c7c 7e7f
7f7f 7f7f 7f7f 3e00 7f7f 7f7f 7f7f 3e00 ]
@keys-middle-icns [
@keys-middle-icns
1c1c 1c1c 1c1c 1c1c 1c1c 1c1c 1c1c 1c1c
1c1c 1c1c 1c1c 3e7f 1c1c 1c1c 1c1c 3e7f
7f7f 7f7f 7f7f 3e00 7f7f 7f7f 7f7f 3e00 ]
@keys-right-icns [
@keys-right-icns
1f1f 1f1f 1f1f 1f1f 1f1f 1f1f 1f1f 1f1f
1f1f 1f1f 1f1f 3f7f 1f1f 1f1f 1f1f 3f7f
7f7f 7f7f 7f7f 3e00 7f7f 7f7f 7f7f 3e00 ]
@knob-icns [
@knob-icns
0003 0c10 2020 4040 0003 0c10 2020 4040
00c0 3008 0404 0202 00c0 3008 0404 0202
4040 2020 100c 0300 4040 2020 100c 0300
0202 0404 0830 c000 0202 0404 0830 c000
0000 183c 3c18 0000 &index
0000 183c 3c18 0000 ]
@knob-offsetx @knob-offsetx [
01 00 00 00 00 01 02 03 01 00 00 00 00 01 02 03
05 06 07 08 08 08 08 07 05 06 07 08 08 08 08 07 ]
@knob-offsety [
@knob-offsety
07 06 05 03 02 01 00 00 07 06 05 03 02 01 00 00
00 00 01 02 03 05 06 07 00 00 01 02 03 05 06 07 ]
@font-hex [
@font-hex ( 0-F )
007c 8282 8282 827c 0030 1010 1010 1010 007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c 007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c 000c 1424 4484 fe04 00fe 8080 7c02 827c
@ -456,9 +438,8 @@ JMP2r
007c 8282 7c82 827c 007c 8282 7e02 827c 007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc 007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc 007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080 007c 8280 f080 827c 007c 8280 f080 8080 ]
@sin-pcm [
@sin-pcm
8083 8689 8c8f 9295 989b 9ea1 a4a7 aaad 8083 8689 8c8f 9295 989b 9ea1 a4a7 aaad
b0b3 b6b9 bbbe c1c3 c6c9 cbce d0d2 d5d7 b0b3 b6b9 bbbe c1c3 c6c9 cbce d0d2 d5d7
d9db dee0 e2e4 e6e7 e9eb ecee f0f1 f2f4 d9db dee0 e2e4 e6e7 e9eb ecee f0f1 f2f4
@ -474,4 +455,5 @@ JMP2r
0102 0202 0202 0303 0405 0506 0708 090a 0102 0202 0202 0303 0405 0506 0708 090a
0b0c 0e0f 1012 1415 1719 1a1c 1e20 2225 0b0c 0e0f 1012 1415 1719 1a1c 1e20 2225
2729 2b2e 3032 3537 3a3d 3f42 4547 4a4d 2729 2b2e 3032 3537 3a3d 3f42 4547 4a4d
5053 5659 5c5f 6265 686b 6e71 7477 7a7d 5053 5659 5c5f 6265 686b 6e71 7477 7a7d ]
&end