add attack and decay commands

This commit is contained in:
Nico 2022-01-21 11:16:06 +00:00
parent 717428c7b4
commit 5195ae31bf
2 changed files with 43 additions and 29 deletions

View File

@ -1,9 +1,6 @@
( TODO
* 0x03 (A) - set attack to argument 1-0f
* 0x04 (D) - set decay to argument 1-0f
* 0x05 (S) - set sustain to argument 1-0f
* 0x06 (R) - set release to argument 1-0f
* 0x07 (T) - set song speed to argument 1-0f
* 0x08 (L) - set sample loop 00: off, otherwise: on )
@k-tick
@ -115,14 +112,31 @@ RTN
,&chan STR
SWP ( get command )
DUP #01 EQU ,&vol JCN ( set volume )
DUP #02 EQU ,&instr JCN ( set instrument )
DUP #02 EQU ,&instrument JCN ( set instrument )
DUP #03 EQU ,&attack JCN ( set attack time )
DUP #04 EQU ,&decay JCN ( set decay time )
DUP #07 EQU ,&speed JCN ( set speed )
POP2 RTN
&vol POP ,&chan LDR #10 MUL .Audio0/volume ADD DEO
RTN
&instr POP ,&chan LDR ;k-load-instrument JSR2
&instrument POP ,&chan LDR ;k-load-instrument JSR2
RTN
&speed POP #0f AND ( only include low byte ) DUP DEBUG .kalama/speed STZ #00 .kalama/tick STZ
&attack POP
#0f AND #40 SFT ( shift new value into appropriate position )
,&chan LDR #10 MUL .Audio0/adsr ADD DEI ( load current value )
#0f AND ( take only decay nibble )
ADD ( add together new attack and old decay )
,&chan LDR #10 MUL .Audio0/adsr ADD DEO ( store )
RTN
&decay POP
#0f AND
,&chan LDR #10 MUL .Audio0/adsr ADD DEI ( load current value )
#f0 AND ( take only attack nibble )
ADD ( add together new decay and old attack )
,&chan LDR #10 MUL .Audio0/adsr ADD DEO ( store )
RTN
&speed POP #0f AND DUP DEBUG .kalama/speed STZ #00 .kalama/tick STZ
RTN
( loads instrument with number into specified audio channel, 0-indexed )

File diff suppressed because one or more lines are too long