639 lines
20 KiB
Tal
639 lines
20 KiB
Tal
( mini music tracker )
|
|
|
|
%RTN { JMP2r }
|
|
%8++ { #0008 ADD2 } %8-- { #0008 SUB2 }
|
|
%8** { #30 SFT2 } %8// { #03 SFT2 }
|
|
%++ { #0001 ADD2 } %2// { #01 SFT2 }
|
|
%MOD8 { #07 AND }
|
|
%TRACK { ;track/ch1 #00 .track/active LDZ #50 SFT2 ADD2 }
|
|
|
|
( variables )
|
|
|
|
@pointer [ &x $2 &y $2 ]
|
|
@color [ &byte $1 ]
|
|
@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
|
|
@trkframe [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
|
|
@chnframe [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
|
|
@ctlframe [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
|
|
@label [ &x $2 &y $2 &color $1 &addr $2 ]
|
|
@knob [ &x $2 &y $2 &value $1 ]
|
|
@head [ &pos $1 ]
|
|
@track [ &active $1 &ch1 $20 &ch2 $20 &ch3 $20 &ch4 $20 ]
|
|
|
|
( devices )
|
|
|
|
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|
|
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|
|
|30 @Audio0 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ]
|
|
|40 @Audio1 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ]
|
|
|50 @Audio2 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ]
|
|
|60 @Audio3 [ &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &len $2 &addr $2 &volume $1 &pitch $1 ]
|
|
|80 @Controller [ &vector $2 &button $1 &key $1 ]
|
|
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|
|
|a0 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
|
|
|
|
( vectors )
|
|
|
|
|0100
|
|
@noise-wave
|
|
|
|
( theme ) #e0fa .System/r DEO2 #30fa .System/g DEO2 #30fa .System/b DEO2
|
|
( vectors ) ;on-screen .Screen/vector DEO2
|
|
( vectors ) ;on-mouse .Mouse/vector DEO2
|
|
( vectors ) ;on-button .Controller/vector DEO2
|
|
|
|
.Screen/width DEI2 2// DUP2 #0080 SUB2 .trkframe/x1 STZ2
|
|
#0080 ADD2 .trkframe/x2 STZ2
|
|
.Screen/height DEI2 2// DUP2 #0038 SUB2 #0010 SUB2 .trkframe/y1 STZ2
|
|
#0038 ADD2 #0010 SUB2 .trkframe/y2 STZ2
|
|
|
|
.trkframe/x1 LDZ2 .chnframe/x1 STZ2 .trkframe/y2 LDZ2 .chnframe/y1 STZ2
|
|
.chnframe/x1 LDZ2 #0030 ADD2 .chnframe/x2 STZ2 .chnframe/y1 LDZ2 #0030 ADD2 .chnframe/y2 STZ2
|
|
|
|
.chnframe/x2 LDZ2 .ctlframe/x1 STZ2 .chnframe/y1 LDZ2 .ctlframe/y1 STZ2
|
|
.trkframe/x2 LDZ2 .ctlframe/x2 STZ2 .chnframe/y2 LDZ2 .ctlframe/y2 STZ2
|
|
|
|
( default settings )
|
|
#048c .Audio0/adsr DEO2 #88 .Audio0/volume DEO
|
|
#159d .Audio1/adsr DEO2 #88 .Audio1/volume DEO
|
|
#26ae .Audio2/adsr DEO2 #88 .Audio2/volume DEO
|
|
#0000 .Audio3/adsr DEO2 #88 .Audio3/volume DEO
|
|
|
|
;square-wave .Audio0/addr DEO2
|
|
;square-wave/end ;square-wave SUB2 .Audio0/len DEO2
|
|
;triangle-wave .Audio1/addr DEO2
|
|
;triangle-wave/end ;triangle-wave SUB2 .Audio1/len DEO2
|
|
;sine-wave .Audio2/addr DEO2
|
|
;sine-wave/end ;sine-wave SUB2 .Audio2/len DEO2
|
|
;noise-wave .Audio3/addr DEO2
|
|
;noise-wave-end ;noise-wave SUB2 .Audio3/len DEO2
|
|
|
|
;draw-timeline JSR2
|
|
;draw-controls JSR2
|
|
;draw-channels JSR2
|
|
|
|
BRK
|
|
|
|
@on-screen ( -> )
|
|
|
|
;move-head JSR2
|
|
;draw-vu JSR2
|
|
.head/pos LDZ MOD8 ,&skip JCN
|
|
;bang JSR2
|
|
&skip
|
|
|
|
BRK
|
|
|
|
@on-mouse ( -> )
|
|
|
|
.Mouse/state DEI #00 EQU ;&click-end JCN2
|
|
.Mouse/x DEI2 .trkframe/x1 LDZ2 GTH2 .Mouse/x DEI2 .trkframe/x2 LDZ2 LTH2 #0101 EQU2
|
|
.Mouse/y DEI2 .trkframe/y1 LDZ2 GTH2 .Mouse/y DEI2 .trkframe/y2 LDZ2 LTH2 #0101 EQU2
|
|
#0101 EQU2 ;touch-trk JCN2
|
|
.Mouse/x DEI2 .chnframe/x1 LDZ2 GTH2 .Mouse/x DEI2 .chnframe/x2 LDZ2 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
|
|
.Mouse/x DEI2 .ctlframe/x1 LDZ2 GTH2 .Mouse/x DEI2 .ctlframe/x2 LDZ2 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
|
|
&click-end
|
|
|
|
;draw-cursor JSR2
|
|
|
|
BRK
|
|
|
|
@on-button ( -> )
|
|
|
|
.Controller/key DEI
|
|
DUP #61 NEQ ,&no-c JCN
|
|
;notes LDA ;play JSR2 &no-c
|
|
DUP #73 NEQ ,&no-d JCN
|
|
;notes #0001 ADD2 LDA ;play JSR2 &no-d
|
|
DUP #64 NEQ ,&no-e JCN
|
|
;notes #0002 ADD2 LDA ;play JSR2 &no-e
|
|
DUP #66 NEQ ,&no-f JCN
|
|
;notes #0003 ADD2 LDA ;play JSR2 &no-f
|
|
DUP #67 NEQ ,&no-g JCN
|
|
;notes #0004 ADD2 LDA ;play JSR2 &no-g
|
|
DUP #68 NEQ ,&no-a JCN
|
|
;notes #0005 ADD2 LDA ;play JSR2 &no-a
|
|
DUP #6a NEQ ,&no-b JCN
|
|
;notes #0006 ADD2 LDA ;play JSR2 &no-b
|
|
DUP #6b NEQ ,&no-c2 JCN
|
|
;notes #0007 ADD2 LDA ;play JSR2 &no-c2
|
|
POP
|
|
|
|
BRK
|
|
|
|
@play ( pitch -- )
|
|
|
|
.Audio0/pitch DEO
|
|
|
|
RTN
|
|
|
|
@touch-trk ( -- )
|
|
|
|
;clear-notes JSR2
|
|
( get note )
|
|
#0e .Mouse/y DEI2 .trkframe/y1 LDZ2 SUB2 NIP #08 DIV SUB
|
|
.Mouse/state DEI #10 NEQ ,&no-erase JCN POP #00 &no-erase
|
|
( edit note )
|
|
TRACK #00 .Mouse/x DEI2 .trkframe/x1 LDZ2 SUB2 NIP #08 DIV ADD2 STA
|
|
( release ) #00 .Mouse/state DEO
|
|
;draw-notes JSR2
|
|
|
|
BRK
|
|
|
|
@touch-chn ( -- )
|
|
|
|
;clear-notes JSR2
|
|
( save ) .Mouse/y DEI2 .chnframe/y1 LDZ2 SUB2 NIP #08 DIV #01 SUB .track/active STZ
|
|
( release ) #00 .Mouse/state DEO
|
|
;draw-channels JSR2
|
|
;draw-notes JSR2
|
|
;draw-controls JSR2
|
|
|
|
BRK
|
|
|
|
@touch-ctl ( -- )
|
|
|
|
.Mouse/x DEI2 .ctlframe/x1 LDZ2 SUB2 8-- 8// NIP #02 DIV
|
|
DUP ,&no-a JCN
|
|
.Audio0/adsr .track/active LDZ #40 SFT ADD DEI
|
|
#10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD
|
|
.Audio0/adsr .track/active LDZ #40 SFT ADD DEO &no-a
|
|
DUP #01 NEQ ,&no-d JCN
|
|
.Audio0/adsr .track/active LDZ #40 SFT ADD DEI
|
|
DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD
|
|
.Audio0/adsr .track/active LDZ #40 SFT ADD DEO &no-d
|
|
DUP #02 NEQ ,&no-s JCN
|
|
.Audio0/adsr .track/active LDZ #40 SFT ADD #01 ADD DEI
|
|
#10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD
|
|
.Audio0/adsr .track/active LDZ #40 SFT ADD #01 ADD DEO &no-s
|
|
DUP #03 NEQ ,&no-r JCN
|
|
.Audio0/adsr .track/active LDZ #40 SFT ADD #01 ADD DEI
|
|
DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD
|
|
.Audio0/adsr .track/active LDZ #40 SFT ADD #01 ADD DEO &no-r
|
|
DUP #05 NEQ ,&no-left JCN
|
|
.Audio0/volume .track/active LDZ #40 SFT ADD DEI
|
|
#10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD
|
|
.Audio0/volume .track/active LDZ #40 SFT ADD DEO &no-left
|
|
DUP #06 NEQ ,&no-right JCN
|
|
.Audio0/volume .track/active LDZ #40 SFT ADD DEI
|
|
DUP #f0 AND STH #01 .Mouse/state DEI #10 EQU #0e MUL ADD ADD #0f AND STHr ADD
|
|
.Audio0/volume .track/active LDZ #40 SFT ADD DEO &no-right
|
|
POP
|
|
( release ) #00 .Mouse/state DEO
|
|
;draw-controls JSR2
|
|
|
|
BRK
|
|
|
|
@bang ( -- )
|
|
|
|
;track/ch1 #00 .head/pos LDZ #08 DIV ADD2 LDA
|
|
#01 SUB
|
|
DUP #ff NEQ ,&skip1 JCN
|
|
POP ,&listen2 JMP
|
|
&skip1
|
|
#00 SWP ;notes ADD2 LDA .Audio0/pitch DEO
|
|
&listen2
|
|
;track/ch2 #00 .head/pos LDZ #08 DIV ADD2 LDA
|
|
#01 SUB
|
|
DUP #ff NEQ ,&skip2 JCN
|
|
POP ,&listen3 JMP
|
|
&skip2
|
|
#00 SWP ;notes ADD2 LDA .Audio1/pitch DEO
|
|
&listen3
|
|
;track/ch3 #00 .head/pos LDZ #08 DIV ADD2 LDA
|
|
#01 SUB
|
|
DUP #ff NEQ ,&skip3 JCN
|
|
POP ,&listen4 JMP
|
|
&skip3
|
|
#00 SWP ;notes ADD2 LDA .Audio2/pitch DEO
|
|
&listen4
|
|
;track/ch4 #00 .head/pos LDZ #08 DIV ADD2 LDA
|
|
#01 SUB
|
|
DUP #ff NEQ ,&skip4 JCN
|
|
POP ,&end JMP
|
|
&skip4
|
|
#00 SWP ;notes ADD2 LDA #80 ORA .Audio3/pitch DEO
|
|
&end
|
|
|
|
RTN
|
|
|
|
@move-head ( -- )
|
|
|
|
( clear )
|
|
.trkframe/y1 LDZ2 8-- .Screen/y DEO2
|
|
.trkframe/x1 LDZ2 #00 .head/pos LDZ ADD2 .Screen/x DEO2
|
|
;head_icn .Screen/addr DEO2
|
|
#00 .Screen/sprite DEO
|
|
( incr ) .head/pos LDZ #01 ADD .head/pos STZ
|
|
.trkframe/x1 LDZ2 #00 .head/pos LDZ ADD2 .Screen/x DEO2
|
|
;head_icn .Screen/addr DEO2
|
|
#01 ( if note ) TRACK #00 .head/pos LDZ #08 DIV ADD2 LDA #00 NEQ ADD .Screen/sprite DEO
|
|
|
|
RTN
|
|
|
|
@clear-notes ( -- )
|
|
|
|
#00 #20
|
|
&loop
|
|
( load ) OVR #00 SWP TRACK ADD2 LDA
|
|
DUP STH #00 SWP #0e SWP SUB 8** .trkframe/y1 LDZ2 ADD2 .Screen/y DEO2
|
|
OVR #00 SWP 8** .trkframe/x1 LDZ2 ADD2 .Screen/x DEO2
|
|
STHr #00 EQU ,&skip JCN
|
|
#00 .Screen/sprite DEO
|
|
&skip
|
|
( incr ) SWP #01 ADD SWP
|
|
DUP2 LTH ,&loop JCN
|
|
POP2
|
|
|
|
RTN
|
|
|
|
@draw-notes ( -- )
|
|
|
|
#00 #20
|
|
¬es-loop
|
|
( load ) OVR #00 SWP TRACK ADD2 LDA
|
|
DUP STH #00 SWP #0e SWP SUB 8** .trkframe/y1 LDZ2 ADD2 .Screen/y DEO2
|
|
OVR #00 SWP 8** .trkframe/x1 LDZ2 ADD2 .Screen/x DEO2
|
|
;note_icn .Screen/addr DEO2
|
|
STHr #00 EQU ,&skip JCN
|
|
#05 .Screen/sprite DEO
|
|
&skip
|
|
( incr ) SWP #01 ADD SWP
|
|
DUP2 LTH ,¬es-loop JCN
|
|
POP2
|
|
;draw-bars JSR2
|
|
|
|
RTN
|
|
|
|
@draw-bars ( -- )
|
|
|
|
.trkframe/x1 LDZ2 .trkframe/y1 LDZ2 .trkframe/x2 LDZ2 .trkframe/y2 LDZ2 #01 ;line-rect JSR2
|
|
|
|
( grid )
|
|
.trkframe/y1 LDZ2 #0010 SUB2 .Screen/y DEO2
|
|
;font_hex .Screen/addr DEO2
|
|
#0000 #0100
|
|
&loop
|
|
OVR2 NIP #02 DIV #0f AND ,&skip JCN
|
|
OVR2 .trkframe/x1 LDZ2 ADD2 .Screen/x DEO2
|
|
.trkframe/y1 LDZ2 #0010 SUB2 .Screen/y DEO2
|
|
#02 .Screen/sprite DEO
|
|
.Screen/addr DEI2 8++ .Screen/addr DEO2
|
|
OVR2 .trkframe/x1 LDZ2 ADD2 .trkframe/y1 LDZ2 ++ .trkframe/y2 LDZ2 #01 ;line-vertical-dotted JSR2
|
|
&skip
|
|
OVR2 .trkframe/x1 LDZ2 ADD2 .trkframe/y1 LDZ2 .trkframe/y2 LDZ2 #01 ;line-vertical-dotted JSR2
|
|
SWP2 8++ SWP2
|
|
OVR2 OVR2 LTH2 ,&loop JCN
|
|
POP2
|
|
POP2
|
|
|
|
.trkframe/x1 LDZ2 .trkframe/x2 LDZ2 .trkframe/y1 LDZ2 8-- #0040 ADD2 #01 ;line-horizontal-dotted JSR2
|
|
|
|
RTN
|
|
|
|
@draw-octave ( x y -- )
|
|
|
|
.Screen/y DEO2
|
|
.Screen/x DEO2
|
|
;octave_icn .Screen/addr DEO2
|
|
.Screen/y DEI2 .Screen/y DEI2 #0038 ADD2
|
|
&loop
|
|
OVR2 .Screen/y DEO2
|
|
#01 .Screen/sprite DEO
|
|
.Screen/addr DEI2 8++ .Screen/addr DEO2
|
|
.Screen/x DEI2 8++ .Screen/x DEO2
|
|
#01 .Screen/sprite DEO
|
|
.Screen/addr DEI2 8++ .Screen/addr DEO2
|
|
.Screen/x DEI2 8-- .Screen/x DEO2
|
|
SWP2 8++ SWP2
|
|
OVR2 OVR2 LTH2 ,&loop JCN
|
|
POP2
|
|
POP2
|
|
|
|
RTN
|
|
|
|
@draw-octaves ( -- )
|
|
|
|
.trkframe/x1 LDZ2 #0018 SUB2 DUP2 .trkframe/y1 LDZ2 ;draw-octave JSR2
|
|
.trkframe/y1 LDZ2 #0038 ADD2 ;draw-octave JSR2
|
|
.trkframe/x1 LDZ2 #0028 SUB2 .Screen/x DEO2
|
|
.trkframe/y1 LDZ2 #0030 ADD2 .Screen/y DEO2
|
|
;font_hex #0020 ADD2 .Screen/addr DEO2
|
|
#03 .Screen/sprite DEO
|
|
.trkframe/x1 LDZ2 #0030 SUB2 .Screen/x DEO2
|
|
;font_hex #0060 ADD2 .Screen/addr DEO2
|
|
#03 .Screen/sprite DEO
|
|
.trkframe/x1 LDZ2 #0028 SUB2 .Screen/x DEO2
|
|
.trkframe/y1 LDZ2 #0068 ADD2 .Screen/y DEO2
|
|
;font_hex #0018 ADD2 .Screen/addr DEO2
|
|
#03 .Screen/sprite DEO
|
|
.trkframe/x1 LDZ2 #0030 SUB2 .Screen/x DEO2
|
|
;font_hex #0060 ADD2 .Screen/addr DEO2
|
|
#03 .Screen/sprite DEO
|
|
|
|
RTN
|
|
|
|
@draw-timeline ( -- )
|
|
|
|
;draw-bars JSR2
|
|
;draw-octaves JSR2
|
|
|
|
RTN
|
|
|
|
@draw-knob ( x* y* value -- )
|
|
.track/active LDZ #03 EQU ;&blank JCN2
|
|
|
|
&force
|
|
( load ) .knob/value STZ .knob/y STZ2 .knob/x STZ2
|
|
|
|
.knob/x LDZ2 .Screen/x DEO2
|
|
.knob/y LDZ2 .Screen/y DEO2 ;knob_icns .Screen/addr DEO2 #01 .Screen/sprite DEO
|
|
.knob/x LDZ2 8++ .Screen/x DEO2 ;knob_icns 8++ .Screen/addr DEO2 #01 .Screen/sprite DEO
|
|
.knob/y LDZ2 8++ .Screen/y DEO2 ;knob_icns #0018 ADD2 .Screen/addr DEO2 #01 .Screen/sprite DEO
|
|
.knob/x LDZ2 .Screen/x DEO2 ;knob_icns #0010 ADD2 .Screen/addr DEO2 #01 .Screen/sprite DEO
|
|
.knob/x LDZ2 #00 #00 .knob/value LDZ ;knob_offsetx ADD2 LDA ADD2 .Screen/x DEO2
|
|
.knob/y LDZ2 #00 #00 .knob/value LDZ ;knob_offsety ADD2 LDA ADD2 .Screen/y DEO2
|
|
;knob_icns #0020 ADD2 .Screen/addr DEO2
|
|
#05 .Screen/sprite DEO
|
|
.knob/x LDZ2 #0004 ADD2 .Screen/x DEO2
|
|
.knob/y LDZ2 #0010 ADD2 .Screen/y DEO2
|
|
;font_hex #00 .knob/value LDZ #30 SFT ADD2 .Screen/addr DEO2
|
|
#01 .Screen/sprite DEO
|
|
|
|
RTN
|
|
|
|
&blank
|
|
|
|
( load ) .knob/value STZ .knob/y STZ2 .knob/x STZ2
|
|
|
|
.knob/x LDZ2 .Screen/x DEO2
|
|
.knob/y LDZ2 .Screen/y DEO2 #00 .Screen/sprite DEO
|
|
.knob/x LDZ2 8++ .Screen/x DEO2 #00 .Screen/sprite DEO
|
|
.knob/y LDZ2 8++ .Screen/y DEO2 #00 .Screen/sprite DEO
|
|
.knob/x LDZ2 .Screen/x DEO2 #00 .Screen/sprite DEO
|
|
.knob/x LDZ2 #0004 ADD2 .Screen/x DEO2
|
|
.knob/y LDZ2 #0010 ADD2 .Screen/y DEO2
|
|
#00 .Screen/sprite DEO
|
|
RTN
|
|
|
|
@draw-controls ( -- )
|
|
|
|
.ctlframe/x1 LDZ2 .ctlframe/y1 LDZ2 .ctlframe/x2 LDZ2 .ctlframe/y2 LDZ2 #01 ;line-rect JSR2
|
|
( env )
|
|
.ctlframe/x1 LDZ2 8++ .ctlframe/y1 LDZ2 8++ #02 ;env_txt ;draw-label JSR2
|
|
.ctlframe/x1 LDZ2 8++ .ctlframe/y1 LDZ2 #0010 ADD2
|
|
.Audio0/adsr .track/active LDZ #40 SFT ADD DEI #04 SFT
|
|
;draw-knob JSR2
|
|
.ctlframe/x1 LDZ2 #0018 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
|
|
.Audio0/adsr .track/active LDZ #40 SFT ADD DEI #0f AND
|
|
;draw-knob JSR2
|
|
.ctlframe/x1 LDZ2 #0028 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
|
|
.Audio0/adsr .track/active LDZ #40 SFT ADD #01 ADD DEI #04 SFT
|
|
;draw-knob JSR2
|
|
.ctlframe/x1 LDZ2 #0038 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
|
|
.Audio0/adsr .track/active LDZ #40 SFT ADD #01 ADD DEI #0f AND
|
|
;draw-knob JSR2
|
|
( vol )
|
|
.ctlframe/x1 LDZ2 #0058 ADD2 .ctlframe/y1 LDZ2 8++ #02 ;vol_txt ;draw-label JSR2
|
|
.ctlframe/x1 LDZ2 #0058 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
|
|
.Audio0/volume .track/active LDZ #40 SFT ADD DEI #04 SFT
|
|
;draw-knob/force JSR2
|
|
.ctlframe/x1 LDZ2 #0068 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
|
|
.Audio0/volume .track/active LDZ #40 SFT ADD DEI #0f AND
|
|
;draw-knob/force JSR2
|
|
|
|
RTN
|
|
|
|
@draw-vu ( -- )
|
|
.ctlframe/x1 LDZ2 #0088 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
|
|
.Audio0/output .track/active LDZ #40 SFT ADD DEI DUP STH #04 SFT
|
|
;draw-knob/force JSR2
|
|
.ctlframe/x1 LDZ2 #0098 ADD2 .ctlframe/y1 LDZ2 #0010 ADD2
|
|
STHr #0f AND
|
|
;draw-knob/force JSR2
|
|
|
|
RTN
|
|
|
|
@draw-channels
|
|
|
|
.chnframe/x1 LDZ2 .chnframe/y1 LDZ2 .chnframe/x2 LDZ2 .chnframe/y2 LDZ2 #01 ;line-rect JSR2
|
|
.chnframe/x1 LDZ2 8++ .chnframe/y1 LDZ2 8++ #01 .track/active LDZ #00 EQU #07 MUL ADD ;ch1_txt ;draw-label JSR2
|
|
.chnframe/x1 LDZ2 8++ .chnframe/y1 LDZ2 #0010 ADD2 #01 .track/active LDZ #01 EQU #07 MUL ADD ;ch2_txt ;draw-label JSR2
|
|
.chnframe/x1 LDZ2 8++ .chnframe/y1 LDZ2 #0018 ADD2 #01 .track/active LDZ #02 EQU #07 MUL ADD ;ch3_txt ;draw-label JSR2
|
|
.chnframe/x1 LDZ2 8++ .chnframe/y1 LDZ2 #0020 ADD2 #01 .track/active LDZ #03 EQU #07 MUL ADD ;ch4_txt ;draw-label JSR2
|
|
|
|
RTN
|
|
|
|
@draw-cursor ( -- )
|
|
|
|
( clear last cursor )
|
|
;clear_icn .Screen/addr DEO2
|
|
.pointer/x LDZ2 .Screen/x DEO2
|
|
.pointer/y LDZ2 .Screen/y DEO2
|
|
#40 .Screen/sprite DEO
|
|
( record pointer positions )
|
|
.Mouse/x DEI2 .pointer/x STZ2 .Mouse/y DEI2 .pointer/y STZ2
|
|
( draw new cursor )
|
|
;cursor_icn .Screen/addr DEO2
|
|
.pointer/x LDZ2 .Screen/x DEO2
|
|
.pointer/y LDZ2 .Screen/y DEO2
|
|
#42 .Mouse/state DEI #00 NEQ ADD .Screen/sprite DEO
|
|
|
|
RTN
|
|
|
|
( generics )
|
|
|
|
@draw-label ( x y color addr -- )
|
|
|
|
( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2 .Screen/x DEO2
|
|
.label/addr LDZ2
|
|
&loop
|
|
( draw ) DUP2 LDA #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/sprite DEO
|
|
( incr ) ++
|
|
( incr ) .Screen/x DEI2 8++ .Screen/x DEO2
|
|
DUP2 LDA ,&loop JCN
|
|
POP2
|
|
|
|
RTN
|
|
|
|
@line-vertical-dotted ( x y0 y1 color -- )
|
|
|
|
.color STZ STH2 SWP2 .Screen/x DEO2 STH2r OVR2 .Screen/y DEO2
|
|
&draw-ver
|
|
( draw ) .color LDZ .Screen/pixel DEO
|
|
( incr ) SWP2 #0002 ADD2 DUP2 .Screen/y DEO2 SWP2
|
|
OVR2 OVR2 LTH2 ,&draw-ver JCN
|
|
POP2 POP2
|
|
|
|
RTN
|
|
|
|
@line-horizontal-dotted ( x0 x1 y color -- )
|
|
|
|
.color STZ .Screen/y DEO2 OVR2 .Screen/x DEO2
|
|
&draw-hor
|
|
( draw ) .color LDZ .Screen/pixel DEO
|
|
( incr ) SWP2 #0002 ADD2 DUP2 .Screen/x DEO2 SWP2
|
|
OVR2 OVR2 LTH2 ,&draw-hor JCN
|
|
POP2 POP2
|
|
|
|
RTN
|
|
|
|
@line-rect ( x1 y1 x2 y2 color )
|
|
|
|
( load ) .color STZ .rect/y2 STZ2 .rect/x2 STZ2 DUP2 .Screen/y DEO2 .rect/y1 STZ2 DUP2 .Screen/x DEO2 .rect/x1 STZ2
|
|
&hor
|
|
( incr ) .Screen/x DEI2 ++ .Screen/x DEO2
|
|
( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
|
( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .color LDZ .Screen/pixel DEO
|
|
.Screen/x DEI2 .rect/x2 LDZ2 LTH2 ,&hor JCN
|
|
.rect/y1 LDZ2 .Screen/y DEO2
|
|
&ver
|
|
( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ .Screen/pixel DEO
|
|
( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .color LDZ .Screen/pixel DEO
|
|
( incr ) .Screen/y DEI2 ++ .Screen/y DEO2
|
|
.Screen/y DEI2 .rect/y2 LDZ2 ++ LTH2 ,&ver JCN
|
|
|
|
RTN
|
|
|
|
@ch1_txt [ "SQR 20 00 ]
|
|
@ch2_txt [ "TRI 20 00 ]
|
|
@ch3_txt [ "SINE 00 ]
|
|
@ch4_txt [ "DRUM 00 ]
|
|
@env_txt [ "Envelope 00 ]
|
|
@vol_txt [ "Volume 00 ]
|
|
|
|
@clear_icn [ 0000 0000 0000 0000 ]
|
|
@cursor_icn [ 80c0 e0f0 f8e0 1000 ]
|
|
@note_icn [ 0000 1c3e 3e3e 1c00 ]
|
|
@head_icn [ 0018 1818 7e3c 1800 ]
|
|
|
|
@notes [
|
|
3c 3e 40 41 43 45 47
|
|
48 4a 4c 4d 4f 51 53
|
|
]
|
|
|
|
@knob_icns [
|
|
0003 0c10 2020 4040
|
|
00c0 3008 0404 0202
|
|
4040 2020 100c 0300
|
|
0202 0404 0830 c000
|
|
0000 183c 3c18 0000
|
|
]
|
|
|
|
@octave_icn [
|
|
ff00 0000 fefe fffe
|
|
ff01 0101 0102 fc00
|
|
fffe fc00 fefe fffe
|
|
ff01 0101 0102 fc00
|
|
fffe fc00 fefe fffe
|
|
ff01 0101 0102 fc00
|
|
fffe fc00 0000 ff00
|
|
ff01 0101 0102 fc00
|
|
ff00 0000 fefe fffe
|
|
ff01 0101 0102 fc00
|
|
fffe fc00 fefe fffe
|
|
ff01 0101 0102 fc00
|
|
fffe fc00 0000 ff00
|
|
ff01 0101 0102 fc00
|
|
]
|
|
|
|
@knob_offsetx [
|
|
01 00 00 00 00 01 02 03
|
|
05 06 07 08 08 08 08 07
|
|
]
|
|
|
|
@knob_offsety [
|
|
07 06 05 03 02 01 00 00
|
|
00 00 01 02 03 05 06 07
|
|
]
|
|
|
|
@font_hex ( 0-F )
|
|
[
|
|
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
|
|
007c 8280 f080 827c 007c 8280 f080 8080
|
|
]
|
|
|
|
@font ( spectrum-zx font )
|
|
[
|
|
0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000
|
|
0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000
|
|
007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000
|
|
0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800
|
|
0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800
|
|
003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038
|
|
0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000
|
|
0000 4040 7e00 0000 0000 0024 6624 0000 0000 1038 7c00 0000 0000 007c 3810 0000
|
|
0000 0000 0000 0000 0008 0808 0800 0800 0014 1400 0000 0000 0024 7e24 247e 2400
|
|
0008 1e28 1c0a 3c08 0042 0408 1020 4200 0030 4832 4c44 3a00 0008 1000 0000 0000
|
|
0004 0808 0808 0400 0010 0808 0808 1000 0000 1408 3e08 1400 0000 0808 3e08 0800
|
|
0000 0000 0008 0810 0000 0000 3c00 0000 0000 0000 0000 0800 0000 0204 0810 2000
|
|
003c 464a 5262 3c00 0018 2808 0808 3e00 003c 4202 3c40 7e00 003c 421c 0242 3c00
|
|
0008 1828 487e 0800 007e 407c 0242 3c00 003c 407c 4242 3c00 007e 0204 0810 1000
|
|
003c 423c 4242 3c00 003c 4242 3e02 3c00 0000 0008 0000 0800 0000 0800 0008 0810
|
|
0000 0810 2010 0800 0000 003e 003e 0000 0000 1008 0408 1000 003c 4202 0c00 0800
|
|
003c 425a 5442 3c00 0018 2442 7e42 4200 007c 427c 4242 7c00 003c 4240 4042 3c00
|
|
0078 4442 4244 7800 007e 407c 4040 7e00 003e 4040 7c40 4000 003c 4240 4e42 3c00
|
|
0042 427e 4242 4200 003e 0808 0808 3e00 0002 0202 4242 3c00 0044 4870 4844 4200
|
|
0040 4040 4040 7e00 0042 665a 4242 4200 0042 6252 4a46 4200 003c 4242 4242 3c00
|
|
007c 4242 7c40 4000 003c 4242 524a 3c00 007c 4242 7c44 4200 003c 403c 0242 3c00
|
|
00fe 1010 1010 1000 0042 4242 4242 3c00 0042 4242 4224 1800 0042 4242 5a66 4200
|
|
0042 2418 1824 4200 0082 4428 1010 1000 007e 0408 1020 7e00 000c 0808 0808 0c00
|
|
0040 2010 0804 0200 0018 0808 0808 1800 0008 1422 0000 0000 0000 0000 0000 7e00
|
|
0008 0400 0000 0000 0000 1c02 1e22 1e00 0020 203c 2222 3c00 0000 1e20 2020 1e00
|
|
0002 021e 2222 1e00 0000 1c22 3c20 1e00 000c 101c 1010 1000 0000 1c22 221e 021c
|
|
0020 202c 3222 2200 0008 0018 0808 0400 0008 0008 0808 4830 0020 2428 3028 2400
|
|
0010 1010 1010 0c00 0000 6854 5454 5400 0000 5864 4444 4400 0000 3844 4444 3800
|
|
0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800
|
|
0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800
|
|
0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00
|
|
0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c
|
|
]
|
|
|
|
@square-wave
|
|
28 d8
|
|
&end
|
|
|
|
@triangle-wave
|
|
8082 8486 888a 8c8e 9092 9496 989a 9c9e a0a2 a4a6 a8aa acae
|
|
b0b2 b4b6 b8ba bcbe c0c1 c3c5 c7c9 cbcd cfd1 d3d5 d7d9 dbdd
|
|
dfe1 e3e5 e7e9 ebed eff1 f3f5 f7f9 fbfd fffd fbf9 f7f5 f3f1
|
|
efed ebe9 e7e5 e3e1 dfdd dbd9 d7d5 d3d1 cfcd cbc9 c7c5 c3c1
|
|
c0be bcba b8b6 b4b2 b0ae acaa a8a6 a4a2 a09e 9c9a 9896 9492
|
|
908e 8c8a 8886 8482 807e 7c7a 7876 7472 706e 6c6a 6866 6462
|
|
605e 5c5a 5856 5452 504e 4c4a 4846 4442 413f 3d3b 3937 3533
|
|
312f 2d2b 2927 2523 211f 1d1b 1917 1513 110f 0d0b 0907 0503
|
|
0103 0507 090b 0d0f 1113 1517 191b 1d1f 2123 2527 292b 2d2f
|
|
3133 3537 393b 3d3f 4142 4446 484a 4c4e 5052 5456 585a 5c5e
|
|
6062 6466 686a 6c6e 7072 7476 787a 7c7e
|
|
&end
|
|
|
|
@sine-wave
|
|
8084 898e 9297 9ca0 a5a9 aeb2 b6bb bfc3 c7cb ced2 d6d9 dce0
|
|
e3e5 e8eb edf0 f2f4 f6f7 f9fa fbfc fdfe fefe fefe fefe fdfc
|
|
fbfa f9f8 f6f4 f2f0 eeeb e9e6 e3e0 ddda d7d3 cfcc c8c4 c0bc
|
|
b8b3 afaa a6a1 9d98 948f 8a85 817c 7772 6e69 6460 5b57 524e
|
|
4a45 413d 3935 312e 2a27 2320 1d1a 1715 1210 0e0c 0a08 0705
|
|
0403 0202 0101 0101 0101 0202 0304 0607 090a 0c0e 1113 1518
|
|
1b1e 2124 282b 2f32 363a 3e42 464b 4f53 585c 6166 6a6f 7478
|
|
7d82 878b 9095 999e a3a7 acb0 b4b9 bdc1 c5c9 cdd0 d4d7 dbde
|
|
e1e4 e7ea ecee f1f3 f5f6 f8f9 fbfc fdfd fefe fefe fefe fdfd
|
|
fcfb faf8 f7f5 f3f1 efed eae8 e5e2 dfdc d8d5 d1ce cac6 c2be
|
|
bab5 b1ad a8a4 9f9b 9691 8d88 837e 7a75 706b 6762 5e59 5550
|
|
4c47 433f 3b37 3330 2c28 2522 1f1c 1916 1411 0f0d 0b09 0706
|
|
0504 0302 0101 0101 0101 0102 0304 0506 0809 0b0d 0f12 1417
|
|
1a1c 1f23 2629 2d31 3438 3c40 4449 4d51 565a 5f63 686d 7176
|
|
7b
|
|
&end
|
|
|
|
@noise-wave-end
|