From c09e1d65a34c3f316877d87334608f5dd49d99ab Mon Sep 17 00:00:00 2001 From: nihilazo Date: Thu, 24 Feb 2022 13:52:42 +0000 Subject: [PATCH] fix song view, update README to reflect that tracker is actually in development again --- README.md | 2 +- tracker.tal | 64 +++++++++++++++++++++++++++-------------------------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 9fca87d..1b5c62e 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ kalama sin is a simple music playback engine for the varvara virtual machine. It uses a tracker-style module format which is documented in format.md. The engine itself is in engine.tal, which you can include in whatever varvara program you wish to add music. It's not super well documented but should be easy enough to figure out from the code. -tracker.tal was the first version of the tracker for kalama module files. It's very early in development (forever), but here in case anybody wants to pick it up, and for historical reasons. \ No newline at end of file +tracker.tal is a very early attempt at building a tracker for the kalama module format \ No newline at end of file diff --git a/tracker.tal b/tracker.tal index 8a77725..e75ee92 100644 --- a/tracker.tal +++ b/tracker.tal @@ -66,6 +66,7 @@ ;module ;k-init-module/run JSR2 ;screen-vector .Screen/vector DEO2 + BRK @screen-vector ( -> ) @@ -78,38 +79,39 @@ BRK BRK @draw-song - .Screen/x DEI2 ;&pos STA2 - #00 ,&count STR - #01 .Screen/auto DEO - .kalama/module LDZ2 #0003 ADD2 DUP2 - LDA2 ( lengthbitaddr* length* ) - ADD2 #0002 ADD2 - STH2 - .kalama/module LDZ2 #0005 ADD2 ( song start address ) - &loop - ,&count LDR #01 ADD DUP ,&count STR ( increase counter for lines ) - #05 NEQ ,&draw JCN - #0008 .Screen/y DEI2 ADD2 .Screen/y DEO2 - ,&pos LDR2 .Screen/x DEO2 - #01 ,&count STR - &draw - DUP2 DUP2 STHrk2 SWP2 SUB2 STH2 - LDA - STHr2 #0004 DIV2 .tracker/selected-pattern LDZ #00 SWP EQU2 ,&selected JCN - ,&unselected JMP - &selected - #08 ,&draw-hex JMP - &unselected - #01 - &draw-hex - ;draw-hex JSR2 - #0001 ADD2 DUP2 - #00 .Screen/sprite DEO - STHrk2 NEQ2 ,&loop JCN ( if not at the end of song, go again ) + .Screen/x DEI2 ,&pos STR2 + #0005 .kalama/module LDZ2 ADD2 DUP2 DUP2 ,&start-addr STR2 ( first song line ) + #0003 .kalama/module LDZ2 ADD2 LDA2 ( song length ) ADD2 STH2 ( stash end address ) + &loop ( start-addr* ) + DUP2 + DUP2 .tracker/selected-pattern LDZ #00 SWP #0004 MUL2 ,&start-addr LDR2 ADD2 EQU2 ( if selected address is this one, use color 08. If not, use 01 ) ,&if JCN + ,&else JMP + &if + #08 ,&end JMP + &else + #01 + &end + ;draw-song-line JSR2 + ,&pos LDR2 .Screen/x DEO2 + .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2 + #0004 ADD2 DUP2 + STHrk2 NEQ2 ,&loop JCN POP2r POP2 RTN - &count $1 - &pos $2 +&pos $2 +&start-addr $2 + +@draw-song-line ( addr* color ) + ,&color STR + DUP2 #0004 ADD2 STH2 ( stash end address ) + &loop ( start-addr* ) + DUP2 LDA ,&color LDR ;draw-hex JSR2 + #00 .Screen/sprite DEO + INC2 DUP2 + STHrk2 NEQ2 ,&loop JCN + POP2r POP2 +RTN +&color $1 @draw-pattern ( p ) @@ -154,6 +156,7 @@ RTN #0c DIV #10 ADD #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 ( octave number ) STHr .Screen/sprite DEO RTN + ¬es "C- "C# "D- "D# "E- "F- "F# "G- "G# "A- "A# "B- ¬e-off #5b #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 ( [ ) STHrk .Screen/sprite DEO @@ -171,7 +174,6 @@ RTN POP RTN - ¬es "C- "C# "D- "D# "E- "F- "F# "G- "G# "A- "A# "B- @draw-hex ( n color -- ) #01 .Screen/auto DEO