0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-17 19:45:11 +00:00
uxn/projects/software/piano.tal

554 lines
13 KiB
Tal
Raw Normal View History

2022-03-25 19:05:11 +00:00
( Piano:
Play notes with the keyboard or the controller )
2021-04-25 20:47:32 +00:00
2023-02-27 04:16:41 +00:00
|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
|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
2023-02-28 04:11:15 +00:00
|40 @Audio1 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
2023-02-27 04:16:41 +00:00
|80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2
2021-04-25 20:47:32 +00:00
|0000
2023-02-27 04:16:41 +00:00
@octave $1
@center &x $2 &y $2
@adsr-view &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
2021-04-25 20:47:32 +00:00
|0100 ( -> )
2023-02-27 04:16:41 +00:00
2022-03-14 18:04:49 +00:00
( theme )
2023-02-27 05:16:56 +00:00
#0fe3 .System/r DEO2
#0fc3 .System/g DEO2
#0f23 .System/b DEO2
( resize )
#0180 .Screen/width DEO2
#00e0 .Screen/height DEO2
2021-04-25 20:47:32 +00:00
( find center )
.Screen/width DEI2 #01 SFT2
DUP2 .center/x STZ2
#0080 SUB2
DUP2 .octave-view/x1 STZ2
#0050 ADD2 .octave-view/x2 STZ2
.Screen/height DEI2 #01 SFT2 #0010 ADD2
DUP2 .center/y STZ2
#0010 ADD2
DUP2 .octave-view/y1 STZ2
#0018 ADD2 .octave-view/y2 STZ2
2021-04-25 20:47:32 +00:00
( place adsr )
2022-03-14 18:04:49 +00:00
.center/x LDZ2 #0020 SUB2 .adsr-view/x1 STZ2
2023-02-27 05:16:56 +00:00
.center/y LDZ2 #0010 ADD2 .adsr-view/y1 STZ2
2022-03-14 18:04:49 +00:00
.adsr-view/x1 LDZ2 #00a0 ADD2 .adsr-view/x2 STZ2
.adsr-view/y1 LDZ2 #0018 ADD2 .adsr-view/y2 STZ2
2021-04-25 20:47:32 +00:00
( place waveform )
2022-03-14 18:04:49 +00:00
.center/x LDZ2 #0080 SUB2 .wave-view/x1 STZ2
2023-02-27 04:16:41 +00:00
.center/y LDZ2 #0040 SUB2 .wave-view/y1 STZ2
2022-03-14 18:04:49 +00:00
.wave-view/x1 LDZ2 #0100 ADD2 .wave-view/x2 STZ2
2023-02-27 04:16:41 +00:00
.wave-view/y1 LDZ2 #0040 ADD2 .wave-view/y2 STZ2
( setup synth )
2023-02-28 04:11:15 +00:00
#041c set-env
#dd set-vol
2021-07-09 18:38:45 +00:00
;sin-pcm .Audio0/addr DEO2
2023-02-28 04:11:15 +00:00
;sin-pcm .Audio1/addr DEO2
#0100
DUP2 .Audio0/length DEO2
.Audio1/length DEO2
2022-03-14 18:04:49 +00:00
( inital drawing )
2023-02-27 04:16:41 +00:00
draw-octave
draw-adsr
draw-wave
( unlock )
;on-frame .Screen/vector DEO2
;on-control .Controller/vector DEO2
;on-mouse .Mouse/vector DEO2
;on-message .Console/vector DEO2
2021-04-25 20:47:32 +00:00
BRK
2023-02-27 05:16:56 +00:00
(
@|vectors )
2021-04-26 02:50:45 +00:00
@on-frame ( -> )
2023-02-27 04:16:41 +00:00
2023-02-28 04:11:15 +00:00
.Mouse/state DEI ?&skip-sft
[ LIT2 00 &soft $1 ] EQUk ?&no-soft
soften
DUP #01 SUB ,&soft STR
&no-soft
POP2
&skip-sft
[ LIT &last $1 ] .Audio0/output DEI NEQk ?&changed
POP2 BRK
&changed
,&last STR POP
( redraw )
2023-02-27 05:16:56 +00:00
[ LIT2 00 -Screen/auto ] DEO
2022-03-14 18:04:49 +00:00
.adsr-view/y2 LDZ2 #0020 SUB2 .Screen/y DEO2
2023-02-27 04:16:41 +00:00
#1000
2021-04-28 19:11:05 +00:00
&loop
2022-03-14 18:04:49 +00:00
.adsr-view/x2 LDZ2 #003a SUB2 .Screen/x DEO2
#10 OVR SUB .Audio0/output DEI
DUP2 #0f AND LTH .Screen/pixel DEO
.Screen/x DEI2k INC2 INC2 ROT DEO2
#04 SFT LTH .Screen/pixel DEO
2022-03-14 18:04:49 +00:00
.Screen/y DEI2k INC2 INC2 ROT DEO2
2023-02-27 04:16:41 +00:00
INC GTHk ?&loop
2021-04-28 19:11:05 +00:00
POP2
2021-04-26 02:50:45 +00:00
BRK
2021-05-11 18:42:12 +00:00
@on-control ( -> )
.Controller/key DEI
2023-02-28 03:18:37 +00:00
( octave )
2023-02-27 04:16:41 +00:00
[ LIT "a ] NEQk NIP ?&no-c #30 .octave LDZ #0c MUL ADD play &no-c
[ LIT "w ] NEQk NIP ?&no-c# #31 .octave LDZ #0c MUL ADD play &no-c#
2023-02-27 04:16:41 +00:00
[ LIT "s ] NEQk NIP ?&no-d #32 .octave LDZ #0c MUL ADD play &no-d
[ LIT "e ] NEQk NIP ?&no-d# #33 .octave LDZ #0c MUL ADD play &no-d#
2023-02-27 04:16:41 +00:00
[ LIT "d ] NEQk NIP ?&no-e #34 .octave LDZ #0c MUL ADD play &no-e
[ LIT "f ] NEQk NIP ?&no-f #35 .octave LDZ #0c MUL ADD play &no-f
[ LIT "t ] NEQk NIP ?&no-f# #36 .octave LDZ #0c MUL ADD play &no-f#
2023-02-27 04:16:41 +00:00
[ LIT "g ] NEQk NIP ?&no-g #37 .octave LDZ #0c MUL ADD play &no-g
[ LIT "y ] NEQk NIP ?&no-g# #38 .octave LDZ #0c MUL ADD play &no-g#
2023-02-27 04:16:41 +00:00
[ LIT "h ] NEQk NIP ?&no-a #39 .octave LDZ #0c MUL ADD play &no-a
[ LIT "u ] NEQk NIP ?&no-a# #3a .octave LDZ #0c MUL ADD play &no-a#
2023-02-27 04:16:41 +00:00
[ LIT "j ] NEQk NIP ?&no-b #3b .octave LDZ #0c MUL ADD play &no-b
[ LIT "k ] NEQk NIP ?&no-c2 #3c .octave LDZ #0c MUL ADD play &no-c2
2023-02-28 03:18:37 +00:00
( controls )
[ LIT "z ] NEQk NIP ?&no-dec .octave LDZk #01 SUB SWP STZ &no-dec
[ LIT "x ] NEQk NIP ?&no-inc .octave LDZk INC SWP STZ &no-inc
2023-02-27 04:16:41 +00:00
[ #1b ] NEQk NIP ?&no-esc #010f DEO &no-esc
2021-05-11 18:42:12 +00:00
POP
( release )
#00 .Controller/key DEO
2022-03-14 18:04:49 +00:00
.Controller/button DEI
2023-02-27 04:16:41 +00:00
[ #11 ] NEQk NIP ?&cu #3c play &cu
[ #21 ] NEQk NIP ?&cd #3d play &cd
[ #41 ] NEQk NIP ?&cl #3e play &cl
[ #81 ] NEQk NIP ?&cr #3f play &cr
[ #12 ] NEQk NIP ?&au #40 play &au
[ #22 ] NEQk NIP ?&ad #41 play &ad
[ #42 ] NEQk NIP ?&al #42 play &al
[ #82 ] NEQk NIP ?&ar #43 play &ar
[ #14 ] NEQk NIP ?&su #44 play &su
[ #24 ] NEQk NIP ?&sd #45 play &sd
[ #44 ] NEQk NIP ?&sl #46 play &sl
[ #84 ] NEQk NIP ?&sr #47 play &sr
2021-05-11 18:42:12 +00:00
POP
2023-02-27 04:16:41 +00:00
draw-octave
2021-05-11 18:42:12 +00:00
BRK
@on-message ( -> )
2023-02-27 04:16:41 +00:00
.Console/read DEI play
draw-octave
BRK
2021-04-25 20:47:32 +00:00
@on-mouse ( -> )
2023-02-27 04:16:41 +00:00
#00 .Mouse/state DEI NEQ #41 ADD ;cursor-icn update-cursor
2021-05-16 04:35:01 +00:00
2023-02-27 04:16:41 +00:00
.Mouse/state DEI ?on-mouse-touch
BRK
@on-mouse-touch ( -> )
.Mouse/x DEI2 .Mouse/y DEI2 .wave-view within-rect
?on-touch-wave-view
.Mouse/x DEI2 .Mouse/y DEI2 .adsr-view within-rect
2023-02-28 03:18:37 +00:00
?on-touch-knobs-view
2023-02-27 04:16:41 +00:00
.Mouse/x DEI2 .Mouse/y DEI2 .octave-view within-rect
?on-touch-octave-view
2021-04-25 20:47:32 +00:00
BRK
@on-touch-wave-view ( -> )
.Mouse/state DEI #01 GTH ?&paint
2023-02-27 04:39:05 +00:00
.Mouse/x DEI2 .wave-view/x1 LDZ2 SUB2
2023-02-27 05:16:56 +00:00
( min ) #0010 GTH2k [ JMP SWP2 POP2 ] set-length
2021-04-25 20:47:32 +00:00
BRK
&paint ( -> )
.Mouse/y DEI2 .wave-view/y1 LDZ2 SUB2 #20 SFT2 NIP
.Mouse/x DEI2 .wave-view/x1 LDZ2 SUB2 ;sin-pcm ADD2 STA
draw-wave
2023-02-28 04:11:15 +00:00
#10 ;on-frame/soft STA
BRK
2021-04-25 20:47:32 +00:00
@on-touch-octave-view ( -> )
2023-02-27 04:16:41 +00:00
.Mouse/x DEI2 .octave-view/x1 LDZ2 SUB2 #03 SFT2 NIP #09 NEQ ?&no-mod
2022-03-14 18:04:49 +00:00
.Mouse/y DEI2 .octave-view/y1 LDZ2 SUB2 #03 SFT2 NIP
2023-02-27 04:16:41 +00:00
[ #00 ] NEQk NIP ?&no-incr
.octave LDZ #03 EQU ?&no-incr
2021-08-18 02:17:47 +00:00
.octave LDZ INC .octave STZ &no-incr
2023-02-27 04:16:41 +00:00
[ #02 ] NEQk NIP ?&no-decr
.octave LDZ #ff EQU ?&no-decr
2022-03-14 18:04:49 +00:00
.octave LDZ #01 SUB .octave STZ &no-decr
2021-04-25 20:47:32 +00:00
POP
( release ) #00 .Mouse/state DEO
2023-02-27 04:16:41 +00:00
draw-octave
2021-04-25 20:47:32 +00:00
BRK
&no-mod
2023-02-27 04:16:41 +00:00
.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-lut ADD2 LDA .octave LDZ #0c MUL ADD play
2021-04-28 18:54:19 +00:00
( release ) #00 .Mouse/state DEO
2023-02-27 04:16:41 +00:00
draw-octave
2021-04-28 18:54:19 +00:00
&no-key
2021-04-25 20:47:32 +00:00
2022-03-14 18:04:49 +00:00
BRK
2021-04-25 20:47:32 +00:00
2023-02-28 03:18:37 +00:00
@on-touch-knobs-view ( -> )
2021-04-25 20:47:32 +00:00
2022-03-14 18:04:49 +00:00
.Mouse/x DEI2 .adsr-view/x1 LDZ2 SUB2 #03 SFT2 NIP #03 DIV
2023-02-28 03:18:37 +00:00
.Mouse/y DEI2 .adsr-view/y1 LDZ2 SUB2 NIP
OVR #04 LTH ?on-touch-adsr
OVR #04 GTH ?on-touch-vol
POP2
BRK
@on-touch-adsr ( knob value -> )
STH2
( mask ) #ffff #000f #03 OVRr STHr SUB #60 SFT SFT2 EOR2
.Audio0/adsr DEI2 AND2
( value ) #000f STHr OVR LTHk [ JMP SWP POP ] SUB
2023-02-28 03:18:37 +00:00
( shift ) #03 STHr SUB #60 SFT SFT2 ORA2
2023-02-28 04:11:15 +00:00
set-env
2023-02-28 03:18:37 +00:00
BRK
@on-touch-vol ( knob value -> )
2021-04-25 21:00:35 +00:00
2023-02-28 03:18:37 +00:00
SWP #03 SUB INC INC SWP STH2
( mask ) #0f OVRr STHr #60 SFT SFT
.Audio0/volume DEI AND
( value ) #0f STHr OVR LTHk [ JMP SWP POP ] SUB
( shift ) #01 STHr SUB #60 SFT SFT ORA
2023-02-28 04:11:15 +00:00
set-vol
2021-04-25 20:47:32 +00:00
BRK
2023-02-27 04:16:41 +00:00
(
@|core )
2021-04-25 20:47:32 +00:00
@play ( pitch -- )
2023-02-27 04:16:41 +00:00
DUP #0c DIVk MUL SUB ;draw-octave/last STA
2023-02-28 04:11:15 +00:00
DUP .Audio0/pitch DEO
#0c SUB .Audio1/pitch DEO
2021-04-25 20:47:32 +00:00
2022-03-14 18:04:49 +00:00
JMP2r
2021-04-25 20:47:32 +00:00
2023-02-27 05:16:56 +00:00
@set-length ( length* -- )
2023-02-28 04:11:15 +00:00
DUP2 .Audio0/length DEO2
.Audio1/length DEO2
2023-02-27 05:16:56 +00:00
!draw-wave
2023-02-28 04:11:15 +00:00
@set-vol ( vol -- )
DUP .Audio0/volume DEO
.Audio1/volume DEO
!draw-adsr
@set-env ( adsr* -- )
DUP2 .Audio0/adsr DEO2
.Audio1/adsr DEO2
!draw-adsr
@soften ( -- )
#0100 #0000
&l
DUP2 ;sin-pcm ADD2 get-average SWP2 STA POP
INC2 GTH2k ?&l
POP2 POP2
draw-wave
JMP2r
@get-average ( addr* -- addr* average* )
[ LIT2r 0000 ]
DUP2 #0001 SUB2 DUP2 #0002 ADD2 SWP2
&l
LDAk LITr 00 STH ADD2r
INC2 GTH2k ?&l
POP2 POP2
LDAk #00 SWP DUP2 DUP2 STH2r
#01 SFT2 ADD2 ADD2 ADD2 #02 SFT2
JMP2r
2023-02-27 05:16:56 +00:00
(
@|drawing )
2023-02-27 04:16:41 +00:00
@update-cursor ( color addr* -- )
[ LIT2 00 -Screen/auto ] DEO
#40 draw-cursor
.Mouse/x DEI2 ,draw-cursor/x STR2
.Mouse/y DEI2 ,draw-cursor/y STR2
.Screen/addr DEO2
@draw-cursor ( color -- )
[ LIT2 &x $2 ] .Screen/x DEO2
[ LIT2 &y $2 ] .Screen/y DEO2
.Screen/sprite DEO
2021-04-25 20:47:32 +00:00
2022-03-14 18:04:49 +00:00
JMP2r
2021-04-25 20:47:32 +00:00
@draw-octave ( -- )
2021-04-28 18:54:19 +00:00
2023-02-27 04:16:41 +00:00
( arrows )
[ LIT2 02 -Screen/auto ] DEO
.octave-view/x1 LDZ2 #0048 ADD2 .Screen/x DEO2
2021-05-11 18:14:52 +00:00
.octave-view/y1 LDZ2 .Screen/y DEO2
2023-02-27 04:16:41 +00:00
;arrow-icns .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEO
2022-03-14 18:04:49 +00:00
;font-hex .octave LDZ #03 ADD #00 SWP #30 SFT2 ADD2 .Screen/addr DEO2
2023-02-27 05:16:56 +00:00
[ LIT2 02 -Screen/sprite ] DEO
2023-02-27 04:16:41 +00:00
;arrow-icns/down .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEO
( octave )
.octave-view/x1 LDZ2 .Screen/x DEO2
.octave-view/y1 LDZ2 .Screen/y DEO2
2023-02-27 04:16:41 +00:00
[ LIT2 06 -Screen/auto ] DEO
[ LITr &last ff ]
;keys-left-icns STHkr #00 EQU INC draw-key
;keys-middle-icns STHkr #02 EQU INC draw-key
;keys-right-icns STHkr #04 EQU INC draw-key
;keys-left-icns STHkr #05 EQU INC draw-key
;keys-middle-icns STHkr #07 EQU INC draw-key
;keys-middle-icns STHkr #09 EQU INC draw-key
;keys-right-icns STHr #0b EQU INC
( >> )
2021-04-25 20:47:32 +00:00
@draw-key ( addr* color -- )
2023-02-27 04:16:41 +00:00
2021-04-25 20:47:32 +00:00
STH
.Screen/addr DEO2
.Screen/y DEI2
STHr .Screen/sprite DEOk DEOk DEO
2022-03-14 18:04:49 +00:00
.Screen/x DEI2k #0008 ADD2 ROT DEO2
.Screen/y DEO2
2021-04-25 20:47:32 +00:00
2022-03-14 18:04:49 +00:00
JMP2r
2021-04-25 20:47:32 +00:00
@draw-adsr ( -- )
2023-02-27 04:16:41 +00:00
2021-05-04 17:57:57 +00:00
( adsr )
2021-05-11 18:14:52 +00:00
.adsr-view/x1 LDZ2 .adsr-view/y1 LDZ2
2023-02-27 04:16:41 +00:00
.Audio0/adsr DEI #04 SFT draw-knob
2022-03-14 18:04:49 +00:00
.adsr-view/x1 LDZ2 #0018 ADD2 .adsr-view/y1 LDZ2
2023-02-27 04:16:41 +00:00
.Audio0/adsr DEI #0f AND draw-knob
2022-03-14 18:04:49 +00:00
.adsr-view/x1 LDZ2 #0030 ADD2 .adsr-view/y1 LDZ2
2023-02-27 04:16:41 +00:00
.Audio0/adsr INC DEI #04 SFT draw-knob
2022-03-14 18:04:49 +00:00
.adsr-view/x1 LDZ2 #0048 ADD2 .adsr-view/y1 LDZ2
2023-02-27 04:16:41 +00:00
.Audio0/adsr INC DEI #0f AND draw-knob
2021-04-28 18:54:19 +00:00
( volume )
2022-03-14 18:04:49 +00:00
.adsr-view/x2 LDZ2 #0028 SUB2 .adsr-view/y1 LDZ2
2023-02-27 04:16:41 +00:00
.Audio0/volume DEI #04 SFT draw-knob
2022-03-14 18:04:49 +00:00
.adsr-view/x2 LDZ2 #0010 SUB2 .adsr-view/y1 LDZ2
2021-04-28 18:54:19 +00:00
.Audio0/volume DEI #0f AND
2023-02-27 04:16:41 +00:00
!draw-knob
2021-04-25 20:47:32 +00:00
@draw-wave ( -- )
2023-02-27 04:16:41 +00:00
2023-02-27 04:39:05 +00:00
( background )
.wave-view/x1 LDZ2 .Screen/x DEO2
.wave-view/y1 LDZ2 .Screen/y DEO2
;fill-icn .Screen/addr DEO2
[ LIT2 75 -Screen/auto ] DEO
#e0 &lbg
;dotted-icn .Screen/addr DEO2
2023-02-27 05:16:56 +00:00
[ LIT2 0c -Screen/sprite ] DEO
2023-02-27 04:39:05 +00:00
INC DUP ?&lbg
POP
2021-05-11 18:14:52 +00:00
.wave-view/x1 LDZ2 .Screen/x DEO2
2021-04-25 20:47:32 +00:00
( waveform )
2023-02-27 04:16:41 +00:00
[ LIT2 01 -Screen/auto ] DEO
;sin-pcm/end ;sin-pcm
2021-04-25 20:47:32 +00:00
&loop
2023-02-27 04:39:05 +00:00
DUP2 ;sin-pcm SUB2 .Audio0/length DEI2 DIV2k MUL2 SUB2 ;sin-pcm ADD2 LDA
2023-02-27 05:16:56 +00:00
#00 SWP #02 SFT2 .wave-view/y1 LDZ2 ADD2 .Screen/y DEO2
2023-02-27 04:39:05 +00:00
( draw ) DUP2 ;sin-pcm SUB2 NIP .Audio0/length DEI2 NIP #01 SUB GTH INC .Screen/pixel DEO
2023-02-27 04:16:41 +00:00
INC2 GTH2k ?&loop
POP2 POP2
2023-02-27 04:39:05 +00:00
( length line )
.wave-view/x1 LDZ2 .Audio0/length DEI2 #0001 SUB2 ADD2 .Screen/x DEO2
.wave-view/y1 LDZ2 .Screen/y DEO2
;line-icn .Screen/addr DEO2
[ LIT2 71 -Screen/auto ] DEO
[ LIT2 05 -Screen/sprite ] DEO
2021-04-25 20:47:32 +00:00
( range )
2023-02-27 05:16:56 +00:00
[ LIT2 01 -Screen/auto ] DEO
2021-05-11 18:14:52 +00:00
.wave-view/x1 LDZ2 .Screen/x DEO2
2023-02-27 05:16:56 +00:00
.wave-view/y1 LDZ2 #0018 SUB2 .Screen/y DEO2
.Audio0/length DEI2
2021-04-25 20:47:32 +00:00
2023-02-27 05:16:56 +00:00
!draw-short
2021-04-25 20:47:32 +00:00
@draw-knob ( x* y* value -- )
2022-03-14 18:04:49 +00:00
STH
OVR2 OVR2 .Screen/y DEO2 .Screen/x DEO2
( circle )
;knob-icns .Screen/addr DEO2
2023-02-27 04:16:41 +00:00
[ LIT2 16 -Screen/auto ] DEO
[ LIT2 01 -Screen/sprite ] DEOk DEO
2022-03-14 18:04:49 +00:00
( value )
#0010 ADD2 .Screen/y DEO2
#0004 ADD2 .Screen/x DEO2
;font-hex #00 STHkr #30 SFT ADD2 .Screen/addr DEO2
2023-02-27 04:16:41 +00:00
[ LIT2 00 -Screen/auto ] DEO
[ LIT2 01 -Screen/sprite ] DEO
2022-03-14 18:04:49 +00:00
( marker )
2023-02-27 04:16:41 +00:00
.Screen/x DEI2 #0004 SUB2 #0000 STHkr ;knob-offsetx ADD2 LDA ADD2 .Screen/x DEO2
.Screen/y DEI2 #0010 SUB2 #0000 STHr ;knob-offsety ADD2 LDA ADD2 .Screen/y DEO2
2023-02-27 05:16:56 +00:00
;knob-icns/index .Screen/addr DEO2
2023-02-27 04:16:41 +00:00
[ LIT2 05 -Screen/sprite ] DEO
2022-03-14 18:04:49 +00:00
JMP2r
@draw-short ( short* -- )
2023-02-27 04:16:41 +00:00
SWP draw-byte
2022-03-14 18:04:49 +00:00
@draw-byte ( byte -- )
2023-02-27 04:16:41 +00:00
DUP #04 SFT draw-hex #0f AND
2022-03-14 18:04:49 +00:00
@draw-hex ( char -- )
#00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2
2023-02-27 04:16:41 +00:00
[ LIT2 02 -Screen/sprite ] DEO
2022-03-14 18:04:49 +00:00
JMP2r
2021-04-25 20:47:32 +00:00
2021-05-16 04:35:01 +00:00
@within-rect ( x* y* rect -- flag )
2023-02-27 04:16:41 +00:00
2021-05-16 04:35:01 +00:00
STH
2023-02-27 04:16:41 +00:00
( y < rect.y1 ) DUP2 STHkr INC INC LDZ2 LTH2 ?&skip
( y > rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ?&skip
2021-05-16 04:35:01 +00:00
SWP2
2023-02-27 04:16:41 +00:00
( x < rect.x1 ) DUP2 STHkr LDZ2 LTH2 ?&skip
( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ?&skip
2021-05-16 04:35:01 +00:00
POP2 POP2 POPr
2022-03-14 18:04:49 +00:00
#01
JMP2r
2021-05-16 04:35:01 +00:00
&skip
POP2 POP2 POPr
#00
2022-03-14 18:04:49 +00:00
JMP2r
2021-05-16 04:35:01 +00:00
2023-02-27 04:16:41 +00:00
@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
2021-04-25 20:47:32 +00:00
2023-02-27 04:16:41 +00:00
(
@|assets )
2021-04-25 20:47:32 +00:00
2023-02-27 05:16:56 +00:00
@notes-lut [
30 32 34 35 37 39 3b 3c ]
2023-02-27 04:39:05 +00:00
@dotted-icn [
0000 0000 0000 0000
0000 0000 0000 0000
0000 0000 0000 0000
0000 0000 0000 0000
aa00 0000 0000 0000
0000 0000 0000 0000
0000 0000 0000 0000
0000 0000 0000 0000 ]
@line-icn [
8080 8080 8080 8080
]
@fill-icn [
ffff ffff ffff ffff ]
2023-02-27 04:16:41 +00:00
@cursor-icn [
80c0 e0f0 f8e0 1000 ]
@arrow-icns [
0010 387c fe10 1000
&down
0010 1010 fe7c 3810 ]
@keys-left-icns [
2021-04-25 20:47:32 +00:00
7c7c 7c7c 7c7c 7c7c
7c7c 7c7c 7c7c 7e7f
2023-02-27 04:16:41 +00:00
7f7f 7f7f 7f7f 3e00 ]
@keys-middle-icns [
2021-04-25 20:47:32 +00:00
1c1c 1c1c 1c1c 1c1c
1c1c 1c1c 1c1c 3e7f
2023-02-27 04:16:41 +00:00
7f7f 7f7f 7f7f 3e00 ]
@keys-right-icns [
2021-04-25 20:47:32 +00:00
1f1f 1f1f 1f1f 1f1f
1f1f 1f1f 1f1f 3f7f
2023-02-27 04:16:41 +00:00
7f7f 7f7f 7f7f 3e00 ]
@knob-icns [
2021-04-25 20:47:32 +00:00
0003 0c10 2020 4040
00c0 3008 0404 0202
4040 2020 100c 0300
0202 0404 0830 c000
2023-02-27 04:16:41 +00:00
&index
0000 183c 3c18 0000 ]
@knob-offsetx [
2021-04-25 20:47:32 +00:00
01 00 00 00 00 01 02 03
2023-02-27 04:16:41 +00:00
05 06 07 08 08 08 08 07 ]
@knob-offsety [
2021-04-25 20:47:32 +00:00
07 06 05 03 02 01 00 00
2023-02-27 04:16:41 +00:00
00 00 01 02 03 05 06 07 ]
@font-hex [
2021-04-25 20:47:32 +00:00
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
007c 8280 fc82 827c 007c 8202 1e02 0202
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
2023-02-27 04:16:41 +00:00
007c 8280 f080 827c 007c 8280 f080 8080 ]
2023-02-28 04:11:15 +00:00
( pad ) [ 8080 8080 ]
2023-02-27 04:16:41 +00:00
@sin-pcm [
2021-05-28 19:37:59 +00:00
8083 8689 8c8f 9295 989b 9ea1 a4a7 aaad
b0b3 b6b9 bbbe c1c3 c6c9 cbce d0d2 d5d7
d9db dee0 e2e4 e6e7 e9eb ecee f0f1 f2f4
f5f6 f7f8 f9fa fbfb fcfd fdfe fefe fefe
fffe fefe fefe fdfd fcfb fbfa f9f8 f7f6
f5f4 f2f1 f0ee eceb e9e7 e6e4 e2e0 dedb
d9d7 d5d2 d0ce cbc9 c6c3 c1be bbb9 b6b3
b0ad aaa7 a4a1 9e9b 9895 928f 8c89 8683
807d 7a77 7471 6e6b 6865 625f 5c59 5653
504d 4a47 4542 3f3d 3a37 3532 302e 2b29
2725 2220 1e1c 1a19 1715 1412 100f 0e0c
0b0a 0908 0706 0505 0403 0302 0202 0202
0102 0202 0202 0303 0405 0506 0708 090a
0b0c 0e0f 1012 1415 1719 1a1c 1e20 2225
2729 2b2e 3032 3537 3a3d 3f42 4547 4a4d
2023-02-27 04:16:41 +00:00
5053 5659 5c5f 6265 686b 6e71 7477 7a7d ]
&end
2023-02-28 04:11:15 +00:00
( pad ) [ 8080 8080 ]