From 9f6d534631225a3446a7e83b2b7b8ce21e1ca05d Mon Sep 17 00:00:00 2001 From: Nihilazo Date: Mon, 24 May 2021 21:54:51 +0100 Subject: [PATCH] add pattern loading from table --- main.usm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.usm b/main.usm index e9e54c2..ee246d9 100644 --- a/main.usm +++ b/main.usm @@ -59,7 +59,7 @@ ( speed - how many ticks we play a note every ) #10 .Playback/speed STZ -;pattern .Playback/pattern-addr STZ2 +#00 ;load-pattern JSR2 ( display/audio init ) ;on-frame .Screen/vector DEO2 @@ -84,6 +84,13 @@ BRK .Playback/pattern-addr LDZ2 #00 .Edit/selection-x LDZ ADD2 #00 .Edit/selection-y LDZ PTN_WIDTH MUL2 ADD2 RTN +@load-pattern ( index -- ) ( loads a pattern from the table ) + #02 MUL #00 SWP ( convert index to an actual index into the table ) + ;pattern_table ADD2 ( add to the table ) + LDA2 ( load the address ) + .Playback/pattern-addr STZ2 ( store in pattern index ) +RTN + @handle-cursor ( controller -- ) ( handles moving the cursor around ) DUP #10 AND #00 NEQ ,&up JCN ( check the if the four directions are pressed ) DUP #20 AND ,&down JCN