(piano.tal) Implemented new auto byte

This commit is contained in:
neauoire 2022-03-14 11:04:49 -07:00
parent 21f3a2d870
commit 3293a1b639
1 changed files with 203 additions and 280 deletions

View File

@ -1,38 +1,11 @@
( piano ) ( piano )
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%!~ { NEQk NIP }
%HALT { #010f DEO }
%RTN { JMP2r }
%TOS { #00 SWP }
%MOD { DUP2 / * - }
%GTS2 { #8000 ++ SWP2 #8000 ++ << }
%2/ { #01 SFT }
%2// { #01 SFT2 }
%4// { #02 SFT2 }
%8// { #03 SFT2 }
%8** { #30 SFT2 }
%AUTO-NONE { #00 .Screen/auto DEO }
%AUTO-X { #01 .Screen/auto DEO }
%AUTO-YADDR { #06 .Screen/auto DEO }
( devices )
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 |00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 |10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|80 @Controller &vector $2 &button $1 &key $1 |80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2 |90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
( variables )
|0000 |0000
@ -49,50 +22,41 @@
@octave-view @octave-view
&x1 $2 &y1 $2 &x2 $2 &y2 $2 &x1 $2 &y1 $2 &x2 $2 &y2 $2
( program )
|0100 ( -> ) |0100 ( -> )
( theme ) ( theme )
#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 ) ( vectors )
;on-frame .Screen/vector DEO2 ;on-frame .Screen/vector DEO2
;on-control .Controller/vector DEO2 ;on-control .Controller/vector DEO2
;on-mouse .Mouse/vector DEO2 ;on-mouse .Mouse/vector DEO2
;on-message .Console/vector DEO2 ;on-message .Console/vector DEO2
( find center ) ( find center )
.Screen/width DEI2 2// .center/x STZ2 .Screen/width DEI2 #01 SFT2 .center/x STZ2
.Screen/height DEI2 2// .center/y STZ2 .Screen/height DEI2 #01 SFT2 .center/y STZ2
( place octave ) ( place octave )
.center/x LDZ2 #0080 -- .octave-view/x1 STZ2 .center/x LDZ2 #0080 SUB2 .octave-view/x1 STZ2
.center/y LDZ2 #0008 ++ .octave-view/y1 STZ2 .center/y LDZ2 #0008 ADD2 .octave-view/y1 STZ2
.octave-view/x1 LDZ2 #0050 ++ .octave-view/x2 STZ2 .octave-view/x1 LDZ2 #0050 ADD2 .octave-view/x2 STZ2
.octave-view/y1 LDZ2 #0018 ++ .octave-view/y2 STZ2 .octave-view/y1 LDZ2 #0018 ADD2 .octave-view/y2 STZ2
( place adsr ) ( place adsr )
.center/x LDZ2 #0020 -- .adsr-view/x1 STZ2 .center/x LDZ2 #0020 SUB2 .adsr-view/x1 STZ2
.center/y LDZ2 #0008 ++ .adsr-view/y1 STZ2 .center/y LDZ2 #0008 ADD2 .adsr-view/y1 STZ2
.adsr-view/x1 LDZ2 #00a0 ++ .adsr-view/x2 STZ2 .adsr-view/x1 LDZ2 #00a0 ADD2 .adsr-view/x2 STZ2
.adsr-view/y1 LDZ2 #0018 ++ .adsr-view/y2 STZ2 .adsr-view/y1 LDZ2 #0018 ADD2 .adsr-view/y2 STZ2
( place waveform ) ( place waveform )
.center/x LDZ2 #0080 -- .wave-view/x1 STZ2 .center/x LDZ2 #0080 SUB2 .wave-view/x1 STZ2
.center/y LDZ2 #0020 -- .wave-view/y1 STZ2 .center/y LDZ2 #0020 SUB2 .wave-view/y1 STZ2
.wave-view/x1 LDZ2 #0100 ++ .wave-view/x2 STZ2 .wave-view/x1 LDZ2 #0100 ADD2 .wave-view/x2 STZ2
.wave-view/y1 LDZ2 #0020 ++ .wave-view/y2 STZ2 .wave-view/y1 LDZ2 #0020 ADD2 .wave-view/y2 STZ2
( default settings ) ( default settings )
#ff .last-note STZ #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 JSR2
;draw-adsr JSR2 ;draw-adsr JSR2
@ -102,15 +66,14 @@ BRK
@on-frame ( -> ) @on-frame ( -> )
.adsr-view/y2 LDZ2 #0020 -- .Screen/y DEO2 .adsr-view/y2 LDZ2 #0020 SUB2 .Screen/y DEO2
#10 #00 #10 #00
&loop &loop
.adsr-view/x2 LDZ2 #003a -- .Screen/x DEO2 .adsr-view/x2 LDZ2 #003a SUB2 .Screen/x DEO2
#10 OVR - .Audio0/output DEI #0f AND < .Screen/pixel DEO #10 OVR SUB .Audio0/output DEI #0f AND LTH .Screen/pixel DEO
.adsr-view/x2 LDZ2 #003a -- INC2 INC2 .Screen/x DEO2 .adsr-view/x2 LDZ2 #003a SUB2 INC2 INC2 .Screen/x DEO2
#10 OVR - .Audio0/output DEI #04 SFT < .Screen/pixel DEO #10 OVR SUB .Audio0/output DEI #04 SFT LTH .Screen/pixel DEO
.Screen/y DEI2 INC2 INC2 .Screen/y DEO2 .Screen/y DEI2k INC2 INC2 ROT DEO2
INC GTHk ,&loop JCN INC GTHk ,&loop JCN
POP2 POP2
@ -124,43 +87,35 @@ BRK
#40 .Screen/sprite DEO #40 .Screen/sprite DEO
.Controller/key DEI .Controller/key DEI
[ LIT 'a ] !~ ,&no-c JCN [ LIT 'a ] NEQk NIP ,&no-c JCN #30 .octave LDZ #0c MUL ADD ;play JSR2 &no-c
#30 .octave LDZ #0c * + ;play JSR2 &no-c [ LIT 's ] NEQk NIP ,&no-d JCN #32 .octave LDZ #0c MUL ADD ;play JSR2 &no-d
[ LIT 's ] !~ ,&no-d JCN [ LIT 'd ] NEQk NIP ,&no-e JCN #34 .octave LDZ #0c MUL ADD ;play JSR2 &no-e
#32 .octave LDZ #0c * + ;play JSR2 &no-d [ LIT 'f ] NEQk NIP ,&no-f JCN #35 .octave LDZ #0c MUL ADD ;play JSR2 &no-f
[ LIT 'd ] !~ ,&no-e JCN [ LIT 'g ] NEQk NIP ,&no-g JCN #37 .octave LDZ #0c MUL ADD ;play JSR2 &no-g
#34 .octave LDZ #0c * + ;play JSR2 &no-e [ LIT 'h ] NEQk NIP ,&no-a JCN #39 .octave LDZ #0c MUL ADD ;play JSR2 &no-a
[ LIT 'f ] !~ ,&no-f JCN [ LIT 'j ] NEQk NIP ,&no-b JCN #3b .octave LDZ #0c MUL ADD ;play JSR2 &no-b
#35 .octave LDZ #0c * + ;play JSR2 &no-f [ LIT 'k ] NEQk NIP ,&no-c2 JCN #3c .octave LDZ #0c MUL ADD ;play JSR2 &no-c2
[ LIT 'g ] !~ ,&no-g JCN [ #1b ] NEQk NIP ,&no-esc JCN #010f DEO &no-esc
#37 .octave LDZ #0c * + ;play JSR2 &no-g
[ LIT 'h ] !~ ,&no-a JCN
#39 .octave LDZ #0c * + ;play JSR2 &no-a
[ LIT 'j ] !~ ,&no-b JCN
#3b .octave LDZ #0c * + ;play JSR2 &no-b
[ LIT 'k ] !~ ,&no-c2 JCN
#3c .octave LDZ #0c * + ;play JSR2 &no-c2
[ #1b ] !~ ,&no-esc JCN HALT &no-esc
POP POP
( release ) ( release )
#00 .Controller/key DEO #00 .Controller/key DEO
.Controller/button DEI .Controller/button DEI
DUP #11 ! ,&cu JCN #3c ;play JSR2 &cu [ #11 ] NEQk NIP ,&cu JCN #3c ;play JSR2 &cu
DUP #21 ! ,&cd JCN #3d ;play JSR2 &cd [ #21 ] NEQk NIP ,&cd JCN #3d ;play JSR2 &cd
DUP #41 ! ,&cl JCN #3e ;play JSR2 &cl [ #41 ] NEQk NIP ,&cl JCN #3e ;play JSR2 &cl
DUP #81 ! ,&cr JCN #3f ;play JSR2 &cr [ #81 ] NEQk NIP ,&cr JCN #3f ;play JSR2 &cr
DUP #12 ! ,&au JCN #40 ;play JSR2 &au [ #12 ] NEQk NIP ,&au JCN #40 ;play JSR2 &au
DUP #22 ! ,&ad JCN #41 ;play JSR2 &ad [ #22 ] NEQk NIP ,&ad JCN #41 ;play JSR2 &ad
DUP #42 ! ,&al JCN #42 ;play JSR2 &al [ #42 ] NEQk NIP ,&al JCN #42 ;play JSR2 &al
DUP #82 ! ,&ar JCN #43 ;play JSR2 &ar [ #82 ] NEQk NIP ,&ar JCN #43 ;play JSR2 &ar
DUP #14 ! ,&su JCN #44 ;play JSR2 &su [ #14 ] NEQk NIP ,&su JCN #44 ;play JSR2 &su
DUP #24 ! ,&sd JCN #45 ;play JSR2 &sd [ #24 ] NEQk NIP ,&sd JCN #45 ;play JSR2 &sd
DUP #44 ! ,&sl JCN #46 ;play JSR2 &sl [ #44 ] NEQk NIP ,&sl JCN #46 ;play JSR2 &sl
DUP #84 ! ,&sr JCN #47 ;play JSR2 &sr [ #84 ] NEQk NIP ,&sr JCN #47 ;play JSR2 &sr
DUP #40 ! ,&l JCN .Audio0/addr DEI2 #0010 -- .Audio0/addr DEO2 &l [ #40 ] NEQk NIP ,&l JCN .Audio0/addr DEI2 #0010 SUB2 .Audio0/addr DEO2 &l
DUP #80 ! ,&r JCN .Audio0/addr DEI2 #0010 ++ .Audio0/addr DEO2 &r [ #80 ] NEQk NIP ,&r JCN .Audio0/addr DEI2 #0010 ADD2 .Audio0/addr DEO2 &r
POP POP
;draw-octave JSR2 ;draw-octave JSR2
@ -179,7 +134,7 @@ BRK
;draw-cursor JSR2 ;draw-cursor JSR2
.Mouse/state DEI #00 ! #01 JCN [ BRK ] .Mouse/state DEI #00 NEQ JMP [ BRK ]
.Mouse/x DEI2 .Mouse/y DEI2 .wave-view ;within-rect JSR2 .Mouse/x DEI2 .Mouse/y DEI2 .wave-view ;within-rect JSR2
;on-touch-wave-view JCN2 ;on-touch-wave-view JCN2
@ -192,7 +147,7 @@ BRK
@on-touch-wave-view ( -> ) @on-touch-wave-view ( -> )
.Mouse/x DEI2 .wave-view/x1 LDZ2 -- .Audio0/length DEO2 .Mouse/x DEI2 .wave-view/x1 LDZ2 SUB2 .Audio0/length DEO2
;draw-wave JSR2 ;draw-wave JSR2
;draw-cursor JSR2 ;draw-cursor JSR2
@ -200,22 +155,22 @@ BRK
@on-touch-octave-view ( -> ) @on-touch-octave-view ( -> )
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// NIP #09 ! ,&no-mod JCN .Mouse/x DEI2 .octave-view/x1 LDZ2 SUB2 #03 SFT2 NIP #09 NEQ ,&no-mod JCN
.Mouse/y DEI2 .octave-view/y1 LDZ2 -- 8// NIP .Mouse/y DEI2 .octave-view/y1 LDZ2 SUB2 #03 SFT2 NIP
[ #00 ] !~ ,&no-incr JCN [ #00 ] NEQk NIP ,&no-incr JCN
.octave LDZ #03 = ,&no-incr JCN .octave LDZ #03 EQU ,&no-incr JCN
.octave LDZ INC .octave STZ &no-incr .octave LDZ INC .octave STZ &no-incr
[ #02 ] !~ ,&no-decr JCN [ #02 ] NEQk NIP ,&no-decr JCN
.octave LDZ #ff = ,&no-decr JCN .octave LDZ #ff EQU ,&no-decr JCN
.octave LDZ #01 - .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 JSR2
BRK BRK
&no-mod &no-mod
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// NIP #06 > ,&no-key JCN .Mouse/x DEI2 .octave-view/x1 LDZ2 SUB2 #03 SFT2 NIP #06 GTH ,&no-key JCN
.Mouse/x DEI2 .octave-view/x1 LDZ2 -- 8// ;notes ++ LDA .octave LDZ #0c * + ;play JSR2 .Mouse/x DEI2 .octave-view/x1 LDZ2 SUB2 #03 SFT2 ;notes ADD2 LDA .octave LDZ #0c MUL ADD ;play JSR2
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
;draw-octave JSR2 ;draw-octave JSR2
&no-key &no-key
@ -224,31 +179,19 @@ BRK
@on-touch-adsr-view ( -> ) @on-touch-adsr-view ( -> )
.Mouse/x DEI2 .adsr-view/x1 LDZ2 -- 8// NIP #03 / .Mouse/x DEI2 .adsr-view/x1 LDZ2 SUB2 #03 SFT2 NIP #03 DIV
[ #00 ] !~ ,&no-a JCN [ #00 ] NEQk NIP ,&no-a JCN
.Audio0/adsr DEI .Audio0/adsr DEI ,&touch2 JSR .Audio0/adsr DEO &no-a
#10 .Mouse/state DEI #10 = #e0 * + + [ #01 ] NEQk NIP ,&no-d JCN
.Audio0/adsr DEO &no-a .Audio0/adsr DEI ,&touch JSR .Audio0/adsr DEO &no-d
[ #01 ] !~ ,&no-d JCN [ #02 ] NEQk NIP ,&no-s JCN
.Audio0/adsr DEI .Audio0/adsr INC DEI ,&touch2 JSR .Audio0/adsr INC DEO &no-s
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr + [ #03 ] NEQk NIP ,&no-r JCN
.Audio0/adsr DEO &no-d .Audio0/adsr INC DEI ,&touch JSR .Audio0/adsr INC DEO &no-r
[ #02 ] !~ ,&no-s JCN [ #05 ] NEQk NIP ,&no-left JCN
.Audio0/adsr INC DEI .Audio0/volume DEI ,&touch2 JSR .Audio0/volume DEO &no-left
#10 .Mouse/state DEI #10 = #e0 * + + [ #06 ] NEQk NIP ,&no-right JCN
.Audio0/adsr INC DEO &no-s .Audio0/volume DEI ,&touch JSR .Audio0/volume DEO &no-right
[ #03 ] !~ ,&no-r JCN
.Audio0/adsr INC DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/adsr INC DEO &no-r
[ #05 ] !~ ,&no-left JCN
.Audio0/volume DEI
#10 .Mouse/state DEI #10 = #e0 * + +
.Audio0/volume DEO &no-left
[ #06 ] !~ ,&no-right JCN
.Audio0/volume DEI
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr +
.Audio0/volume DEO &no-right
POP POP
( release ) #00 .Mouse/state DEO ( release ) #00 .Mouse/state DEO
@ -256,13 +199,15 @@ BRK
;draw-cursor JSR2 ;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
&touch2 #10 .Mouse/state DEI #01 GTH #e0 MUL ADD ADD JMP2r
@play ( pitch -- ) @play ( pitch -- )
DUP #0c MOD .last-note STZ DUP #0c ( mod ) [ DIVk MUL SUB ] .last-note STZ
.Audio0/pitch DEO .Audio0/pitch DEO
RTN JMP2r
@draw-cursor ( -- ) @draw-cursor ( -- )
@ -275,40 +220,40 @@ RTN
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 .Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 .Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2
( colorize on state ) ( colorize on state )
#41 [ .Mouse/state DEI #00 ! ] + .Screen/sprite DEO #41 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/sprite DEO
RTN JMP2r
@draw-octave ( -- ) @draw-octave ( -- )
.octave-view/x1 LDZ2 #0048 ++ .Screen/x DEO2 .octave-view/x1 LDZ2 #0048 ADD2 .Screen/x DEO2
;arrow-icns .Screen/addr DEO2 ;arrow-icns .Screen/addr DEO2
.octave-view/y1 LDZ2 .Screen/y DEO2 .octave-view/y1 LDZ2 .Screen/y DEO2
#01 .Screen/sprite DEO #01 .Screen/sprite DEO
;arrow-icns #0008 ++ .Screen/addr DEO2 ;arrow-icns/down .Screen/addr DEO2
.octave-view/y1 LDZ2 #0010 ++ .Screen/y DEO2 .octave-view/y1 LDZ2 #0010 ADD2 .Screen/y DEO2
#01 .Screen/sprite DEO #01 .Screen/sprite DEO
;font-hex .octave LDZ #03 + #00 SWP 8** ++ .Screen/addr DEO2 ;font-hex .octave LDZ #03 ADD #00 SWP #30 SFT2 ADD2 .Screen/addr DEO2
.octave-view/y1 LDZ2 #0008 ++ .Screen/y DEO2 .octave-view/y1 LDZ2 #0008 ADD2 .Screen/y DEO2
#03 .Screen/sprite DEO #03 .Screen/sprite DEO
.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
AUTO-YADDR #06 .Screen/auto DEO
.last-note LDZ STH .last-note LDZ STH
;keys-left-icns STHkr #00 = INC ,draw-key JSR ;keys-left-icns STHkr #00 EQU INC ,draw-key JSR
;keys-middle-icns STHkr #02 = INC ,draw-key JSR ;keys-middle-icns STHkr #02 EQU INC ,draw-key JSR
;keys-right-icns STHkr #04 = INC ,draw-key JSR ;keys-right-icns STHkr #04 EQU INC ,draw-key JSR
;keys-left-icns STHkr #05 = INC ,draw-key JSR ;keys-left-icns STHkr #05 EQU INC ,draw-key JSR
;keys-middle-icns STHkr #07 = INC ,draw-key JSR ;keys-middle-icns STHkr #07 EQU INC ,draw-key JSR
;keys-middle-icns STHkr #09 = INC ,draw-key JSR ;keys-middle-icns STHkr #09 EQU INC ,draw-key JSR
;keys-right-icns STHr #0b = INC ,draw-key JSR ;keys-right-icns STHr #0b EQU INC ,draw-key JSR
AUTO-NONE #00 .Screen/auto DEO
RTN JMP2r
@draw-key ( addr* color -- ) @draw-key ( addr* color -- )
@ -316,10 +261,10 @@ RTN
.Screen/addr DEO2 .Screen/addr DEO2
.Screen/y DEI2 .Screen/y DEI2
STHr .Screen/sprite DEOk DEOk DEO STHr .Screen/sprite DEOk DEOk DEO
.Screen/x DEI2k #0008 ++ ROT DEO2 .Screen/x DEI2k #0008 ADD2 ROT DEO2
.Screen/y DEO2 .Screen/y DEO2
RTN JMP2r
@draw-adsr ( -- ) @draw-adsr ( -- )
@ -327,34 +272,27 @@ RTN
.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 JSR2 ;draw-knob JSR2
.adsr-view/x1 LDZ2 #0018 ++ .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 JSR2 ;draw-knob JSR2
.adsr-view/x1 LDZ2 #0030 ++ .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 JSR2 ;draw-knob JSR2
.adsr-view/x1 LDZ2 #0048 ++ .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 JSR2 ;draw-knob JSR2
( volume ) ( volume )
.adsr-view/x2 LDZ2 #0028 -- .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 JSR2 ;draw-knob JSR2
.adsr-view/x2 LDZ2 #0010 -- .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 ;draw-knob JSR2
RTN JMP2r
@draw-wave ( -- ) @draw-wave ( -- )
( clear )
.wave-view/x1 LDZ2
.wave-view/y1 LDZ2
.wave-view/x2 LDZ2 INC2
.wave-view/y2 LDZ2
#00 ;fill-rect JSR2
#01 ;draw-wave-length JSR2 #01 ;draw-wave-length JSR2
.wave-view/x1 LDZ2 .Screen/x DEO2 .wave-view/x1 LDZ2 .Screen/x DEO2
@ -364,35 +302,45 @@ RTN
&loop &loop
( dotted line ) ( dotted line )
DUP #01 AND ,&no-dot JCN DUP #01 AND ,&no-dot JCN
.wave-view/y1 LDZ2 #0010 ++ .Screen/y DEO2 .wave-view/y1 LDZ2 #0010 ADD2 .Screen/y DEO2
#03 .Screen/pixel DEO #03 .Screen/pixel DEO
&no-dot &no-dot
#00 OVR .Audio0/addr DEI2 ++ LDA #00 OVR .Audio0/addr DEI2 ADD2 LDA
2/ #01 SFT
TOS 4// .wave-view/y1 LDZ2 ++ .Screen/y DEO2 #00 SWP #02 SFT2 .wave-view/y1 LDZ2 ADD2 .Screen/y DEO2
.Screen/x DEI2 INC2 .Screen/x DEO2 .Screen/x DEI2 INC2 .Screen/x DEO2
( draw ) DUP ( draw ) DUP
.Audio0/length DEI2 NIP > .Audio0/length DEI2 NIP GTH
.Audio0/length DEI2 #0100 !! #0101 == DUP ADD INC .Screen/pixel DEO .Audio0/length DEI2 #0100 NEQ2 AND DUP ADD INC .Screen/pixel DEO
INC GTHk ,&loop JCN INC GTHk ,&loop JCN
POP2 POP2
( range ) ( range )
AUTO-X #01 .Screen/auto DEO
.wave-view/x1 LDZ2 .Screen/x DEO2 .wave-view/x1 LDZ2 .Screen/x DEO2
.wave-view/y1 LDZ2 #0010 -- .Screen/y DEO2 .wave-view/y1 LDZ2 #0010 SUB2 .Screen/y DEO2
.Audio0/addr DEI2 #02 ;draw-short JSR2 .Audio0/addr DEI2 ;draw-short JSR2
.wave-view/x2 LDZ2 #0020 -- .Screen/x DEO2 .wave-view/x2 LDZ2 #0020 SUB2 .Screen/x DEO2
.Audio0/length DEI2 #02 ;draw-short JSR2 .Audio0/length DEI2 ;draw-short JSR2
AUTO-NONE #00 .Screen/auto DEO
RTN JMP2r
@draw-wave-length ( color -- ) @draw-wave-length ( color -- )
( clear background )
#f2 .Screen/auto DEO
.wave-view/x1 LDZ2 DUP2 .Screen/x DEO2
.wave-view/y1 LDZ2 DUP2 .Screen/y DEO2
,&wipe JSR
.Screen/y DEO2
#0080 ADD2 .Screen/x DEO2
,&wipe JSR
#00 .Screen/auto DEO
STH STH
.wave-view/x1 LDZ2 .Audio0/length DEI2 ++ .Screen/x DEO2 .wave-view/x1 LDZ2 .Audio0/length DEI2 ADD2 .Screen/x DEO2
.wave-view/y1 LDZ2 DUP2 #0020 ++ SWP2 .wave-view/y1 LDZ2 DUP2 #0020 ADD2 SWP2
&loop &loop
DUP2 .Screen/y DEO2 DUP2 .Screen/y DEO2
( draw ) STHkr .Screen/pixel DEO ( draw ) STHkr .Screen/pixel DEO
@ -400,71 +348,45 @@ RTN
POP2 POP2 POP2 POP2
POPr POPr
RTN JMP2r
&wipe #00 .Screen/sprite DEOk DEOk DEOk DEO JMP2r
@draw-knob ( x* y* value -- ) @draw-knob ( x* y* value -- )
( load ) STH .Screen/y DEO2 .Screen/x DEO2 STH
OVR2 OVR2 .Screen/y DEO2 .Screen/x DEO2
( circle )
;knob-icns .Screen/addr DEO2 ;knob-icns .Screen/addr DEO2
( draw ) #01 .Screen/sprite DEO #16 .Screen/auto DEO
.Screen/x DEI2 #0008 ++ .Screen/x DEO2 #01 .Screen/sprite DEOk DEO
;knob-icns #0008 ++ .Screen/addr DEO2 #00 .Screen/auto DEO
( draw ) #01 .Screen/sprite DEO ( value )
.Screen/y DEI2 #0008 ++ .Screen/y DEO2 #0010 ADD2 .Screen/y DEO2
;knob-icns #0018 ++ .Screen/addr DEO2 #0004 ADD2 .Screen/x DEO2
( draw ) #01 .Screen/sprite DEO ;font-hex #00 STHkr #30 SFT ADD2 .Screen/addr DEO2
.Screen/x DEI2 #0008 -- .Screen/x DEO2 #01 .Screen/sprite DEO
;knob-icns #0010 ++ .Screen/addr DEO2 ( marker )
( draw ) #01 .Screen/sprite DEO .Screen/x DEI2 #0004 SUB2 #00 #00 STHkr ;knob-offsetx ADD2 LDA ADD2 .Screen/x DEO2
.Screen/x DEI2 #0004 ++ .Screen/x DEO2 .Screen/y DEI2 #0010 SUB2 #00 #00 STHr ;knob-offsety ADD2 LDA ADD2 .Screen/y DEO2
.Screen/y DEI2 #0008 ++ .Screen/y DEO2 ;knob-icns #0020 ADD2 .Screen/addr DEO2
;font-hex #00 STHkr #30 SFT ++ .Screen/addr DEO2 #05 .Screen/sprite DEO
( draw ) #01 .Screen/sprite DEO
.Screen/x DEI2 #0004 -- #00 #00 STHkr ;knob-offsetx ++ LDA ++ .Screen/x DEO2
.Screen/y DEI2 #0010 -- #00 #00 STHr ;knob-offsety ++ LDA ++ .Screen/y DEO2
;knob-icns #0020 ++ .Screen/addr DEO2
( draw ) #05 .Screen/sprite DEO
RTN JMP2r
@draw-short ( short* color -- ) @draw-short ( short* -- )
STH SWP ,draw-byte JSR
SWP STHkr ,draw-byte JSR
STHr
@draw-byte ( byte color -- ) @draw-byte ( byte -- )
STH DUP #04 SFT ,draw-hex JSR #0f AND
DUP #04 SFT STHkr ,draw-hex JSR #0f AND
STHr
@draw-hex ( char color -- ) @draw-hex ( char -- )
SWP TOS 8** ;font-hex ++ .Screen/addr DEO2 #00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2
.Screen/sprite DEO #02 .Screen/sprite DEO
RTN JMP2r
@fill-rect ( x1* y1* x2* y2* color -- )
,&color STR
( x1 x2 y1 y2 ) ROT2
&ver
( save ) DUP2 .Screen/y DEO2
STH2 STH2 OVR2 OVR2 SWP2
&hor
( save ) DUP2 .Screen/x DEO2
( draw ) ,&color LDR .Screen/pixel DEO
( incr ) INC2
OVR2 OVR2 GTS2 ,&hor JCN
POP2 POP2 STH2r STH2r
( incr ) INC2
OVR2 OVR2 GTS2 ,&ver JCN
POP2 POP2 POP2 POP2
RTN
&color $1
@within-rect ( x* y* rect -- flag ) @within-rect ( x* y* rect -- flag )
@ -476,18 +398,19 @@ RTN
( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN ( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN
POP2 POP2 POPr POP2 POP2 POPr
#01 #01
RTN JMP2r
&skip &skip
POP2 POP2 POPr POP2 POP2 POPr
#00 #00
RTN JMP2r
@cursor @cursor
80c0 e0f0 f8e0 1000 80c0 e0f0 f8e0 1000
@arrow-icns @arrow-icns
0010 387c fe10 1000 0010 387c fe10 1000
&down
0010 1010 fe7c 3810 0010 1010 fe7c 3810
@notes @notes