add sustain command

This commit is contained in:
Nico 2022-01-21 19:13:46 +00:00
parent 5195ae31bf
commit a1ecbde663
2 changed files with 29 additions and 21 deletions

View File

@ -109,31 +109,39 @@ RTN
@k-run-command ( c arg channel ) @k-run-command ( c arg channel )
&chan $1 &chan $1
&run &run
,&chan STR ;&chan STA
SWP ( get command ) SWP ( get command )
DUP #01 EQU ,&vol JCN ( set volume ) DUP #01 EQU ;&vol JCN2 ( set volume )
DUP #02 EQU ,&instrument JCN ( set instrument ) DUP #02 EQU ;&instrument JCN2 ( set instrument )
DUP #03 EQU ,&attack JCN ( set attack time ) DUP #03 EQU ;&attack JCN2 ( set attack time )
DUP #04 EQU ,&decay JCN ( set decay time ) DUP #04 EQU ;&decay JCN2 ( set decay time )
DUP #07 EQU ,&speed JCN ( set speed ) DUP #05 EQU ;&sustain JCN2 ( set sustain time )
DUP #07 EQU ;&speed JCN2 ( set speed )
POP2 RTN POP2 RTN
&vol POP ,&chan LDR #10 MUL .Audio0/volume ADD DEO &vol POP ;&chan LDA #10 MUL .Audio0/volume ADD DEO
RTN RTN
&instrument POP ,&chan LDR ;k-load-instrument JSR2 &instrument POP ;&chan LDA ;k-load-instrument JSR2
RTN RTN
&attack POP &attack POP
#0f AND #40 SFT ( shift new value into appropriate position ) #0f AND #40 SFT ( shift new value into appropriate position )
,&chan LDR #10 MUL .Audio0/adsr ADD DEI ( load current value ) ;&chan LDA #10 MUL .Audio0/adsr ADD DEI ( load current value )
#0f AND ( take only decay nibble ) #0f AND ( take only decay nibble )
ADD ( add together new attack and old decay ) ADD ( add together new attack and old decay )
,&chan LDR #10 MUL .Audio0/adsr ADD DEO ( store ) ;&chan LDA #10 MUL .Audio0/adsr ADD DEO ( store )
RTN RTN
&decay POP &decay POP
#0f AND #0f AND
,&chan LDR #10 MUL .Audio0/adsr ADD DEI ( load current value ) ;&chan LDA #10 MUL .Audio0/adsr ADD DEI ( load current value )
#f0 AND ( take only attack nibble ) #f0 AND ( take only attack nibble )
ADD ( add together new decay and old attack ) ADD ( add together new decay and old attack )
,&chan LDR #10 MUL .Audio0/adsr ADD DEO ( store ) ;&chan LDA #10 MUL .Audio0/adsr ADD DEO ( store )
RTN
&sustain POP
#0f AND #40 SFT ( shift new value into appropriate position )
;&chan LDA #10 MUL .Audio0/adsr #01 ADD ADD DEI ( load current value )
#0f AND ( take only decay nibble )
ADD ( add together new attack and old decay )
;&chan LDA #10 MUL .Audio0/adsr #01 ADD ADD DEO ( store )
RTN RTN
&speed POP #0f AND DUP DEBUG .kalama/speed STZ #00 .kalama/tick STZ &speed POP #0f AND DUP DEBUG .kalama/speed STZ #00 .kalama/tick STZ

View File

@ -94,13 +94,13 @@ ff 02 ff ff ( song table, 2 rows )
@DEBUG-patterns @DEBUG-patterns
( pattern 00 ) ( pattern 00 )
54 02 00 ( C-3 I00 ) 54 02 00 ( C-3 I00 )
52 00 00 52 05 00
54 00 00 54 00 00
4f 00 00 4f 00 00
4b 00 00 4b 00 00
4f 00 00 4f 00 00
48 00 00 48 00 00
ff 04 08 ff 05 0f
54 00 00 54 00 00
52 00 00 52 00 00
54 00 00 54 00 00
@ -110,28 +110,28 @@ ff 04 08
48 00 00 48 00 00
ff 00 00 ff 00 00
( pattern 01 ) ( pattern 01 )
54 03 00 54 05 04
56 00 00 56 00 00
57 00 00 57 00 00
56 00 00 56 00 00
57 00 00 57 00 00
54 00 00 54 00 00
56 04 04 56 00 00
54 00 00 54 00 00
56 00 00 56 00 00
52 00 00 52 05 00
54 04 00 54 00 00
52 00 00 52 00 00
54 00 00 54 00 00
50 00 00 50 00 00
54 00 00 54 05 0f
ff 00 00 ff 00 00
( pattern 02 ) ( pattern 02 )
3c 02 01 3c 02 01
00 00 00 00 00 00
3c 04 04 3c 00 00
00 00 00 00 00 00
3c 03 00 3c 00 00
00 00 00 00 00 00
3c 00 00 3c 00 00
00 00 00 00 00 00