first version of multi-channel playback

This commit is contained in:
Nico 2022-01-20 17:05:42 +00:00
parent 428029e062
commit 84deaea3d2
3 changed files with 19 additions and 8 deletions

7
Makefile Normal file
View File

@ -0,0 +1,7 @@
all: player.rom run
player.rom: player.tal engine.tal
uxnasm player.tal player.rom
run: player.rom
uxnemu player.rom

View File

@ -1,5 +1,4 @@
( TODO
multiple channels
commmands )
@k-tick
@ -11,13 +10,16 @@ commmands )
&play
POP
#ff .kalama/tick STZ
.kalama/line LDZ #01 ADD STHk ( line )
#00 SWP #0003 MUL2 ( lineaddr* )
.kalama/songpos LDZ2 DUP2 ( songpos* songpos* lineaddr* )
.kalama/line LDZ #01 ADD STHk ( rst: line )
#00 SWP #0003 MUL2 ;&lineaddr STA2 ( store line address offset )
.kalama/songpos LDZ2 DUP2 ( songpos* songpos )
( don't play if song pos is ffff aka song is stopped or over )
#ffff EQU2 ,&no-play JCN ( songpos* lineaddr* )
#0005 ADD2 .kalama/module LDZ2 ADD2 ( songposinmod* lineaddr* )
LDA ( -- pattern1 lineaddr* ) ;k-get-pattern/run JSR2 ADD2 #00 ;k-play-line/run JSR2 ( -- )
#ffff EQU2 ;&no-play JCN2 ( songpos* )
#0005 ADD2 .kalama/module LDZ2 ADD2 ( songposinmod* )
DUP2 LDA ;k-get-pattern/run JSR2 ;&lineaddr LDA2 ADD2 #00 ;k-play-line/run JSR2
DUP2 #0001 ADD2 LDA ;k-get-pattern/run JSR2 ;&lineaddr LDA2 ADD2 #01 ;k-play-line/run JSR2
DUP2 #0002 ADD2 LDA ;k-get-pattern/run JSR2 ;&lineaddr LDA2 ADD2 #02 ;k-play-line/run JSR2
#0003 ADD2 LDA ;k-get-pattern/run JSR2 ;&lineaddr LDA2 ADD2 #03 ;k-play-line/run JSR2
STHrk #0f EQU ,&next JCN
STHr .kalama/line STZ
RTN
@ -38,6 +40,7 @@ RTN
&no-play
POP2 POP2 POPr
RTN
&lineaddr $2
( initialises kalama with module data )
@k-init-module ( addr* -- )

View File

@ -1,3 +1,4 @@
( a blank file )
%DEBUG { ;print-hex/byte JSR2 #0a18 DEO }
@ -149,7 +150,7 @@ ff 00 00
@DEBUG-instruments
( instrument 00 )
0002 ( sample length )
ff ( volume )
88 ( volume )
80 ( flags - loop sample )
0060 ( ADSR )
ff 00 ( square wave sample data )