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