add pattern loading from table

This commit is contained in:
Nico 2021-05-24 21:54:51 +01:00
parent 9fe92b04a6
commit 9f6d534631
1 changed files with 8 additions and 1 deletions

View File

@ -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