make instrument lookup not super bad
This commit is contained in:
parent
628ed099fc
commit
d23350ebcb
21
player.tal
21
player.tal
|
@ -26,6 +26,7 @@
|
||||||
@kalama
|
@kalama
|
||||||
&module $2 ( pointer to start of module file )
|
&module $2 ( pointer to start of module file )
|
||||||
&loopflags $1 ( if different channels are set to loop )
|
&loopflags $1 ( if different channels are set to loop )
|
||||||
|
&instruments $2 ( address that instruments start at )
|
||||||
|
|
||||||
( program )
|
( program )
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@
|
||||||
#0fc5 .System/g DEO2
|
#0fc5 .System/g DEO2
|
||||||
#0f25 .System/b DEO2
|
#0f25 .System/b DEO2
|
||||||
|
|
||||||
;module .kalama/module STZ2
|
;module ;k-init-module JSR2
|
||||||
|
|
||||||
;on-frame/run .Screen/vector DEO2
|
;on-frame/run .Screen/vector DEO2
|
||||||
#00 #00 ;k-load-instrument/run JSR2
|
#00 #00 ;k-load-instrument/run JSR2
|
||||||
|
@ -47,6 +48,16 @@ BRK
|
||||||
&run
|
&run
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
( initialises kalama with module data )
|
||||||
|
@k-init-module ( addr* -- )
|
||||||
|
&run
|
||||||
|
DUP2 .kalama/module STZ2 ( store module address )
|
||||||
|
#0001 ADD2 LDA ( get pattern count byte )
|
||||||
|
;k-get-pattern/run JSR2 ( get the "pattern" that is 1 over the pattern index numbers. This is the first byte of the instruments )
|
||||||
|
.kalama/instruments STZ2
|
||||||
|
|
||||||
|
RTN
|
||||||
|
|
||||||
( gets the memory address of the given pattern in loaded module )
|
( gets the memory address of the given pattern in loaded module )
|
||||||
@k-get-pattern ( number -- addr* )
|
@k-get-pattern ( number -- addr* )
|
||||||
&run
|
&run
|
||||||
|
@ -73,11 +84,7 @@ RTN
|
||||||
@k-get-instrument ( number -- addr* )
|
@k-get-instrument ( number -- addr* )
|
||||||
&run
|
&run
|
||||||
STH ( store instrument number for later )
|
STH ( store instrument number for later )
|
||||||
.kalama/module LDZ2 ( get module start address )
|
.kalama/instruments LDZ2
|
||||||
#0001 ADD2 LDA ( get pattern count byte )
|
|
||||||
;k-get-pattern/run JSR2 ( get that "pattern". This is 1 over the number of patterns, so this spits us out at the first byte after all the patterns which is the first byte of the first instrument )
|
|
||||||
( TODO don't recalculate this every time )
|
|
||||||
|
|
||||||
( we are now at the size byte of instrument 00, the start of instrument memory )
|
( we are now at the size byte of instrument 00, the start of instrument memory )
|
||||||
&loop
|
&loop
|
||||||
STHrk #00 EQU ,&end JCN
|
STHrk #00 EQU ,&end JCN
|
||||||
|
@ -180,7 +187,7 @@ ff be
|
||||||
0002 ( sample length )
|
0002 ( sample length )
|
||||||
ff ( volume )
|
ff ( volume )
|
||||||
80 ( flags - loop sample )
|
80 ( flags - loop sample )
|
||||||
10f0 ( ADSR )
|
05f5 ( ADSR )
|
||||||
ff 00 ( square wave sample data )
|
ff 00 ( square wave sample data )
|
||||||
( instrument 01, unused )
|
( instrument 01, unused )
|
||||||
0008 ( sample length )
|
0008 ( sample length )
|
||||||
|
|
Reference in New Issue