added pattern table. This is the start of something BIG (multiple patterns)

This commit is contained in:
Nico 2021-05-17 21:28:58 +01:00
parent b271e68e21
commit 5868e040f4
1 changed files with 10 additions and 2 deletions

View File

@ -38,7 +38,7 @@
|0000
@Playback [ &position $2 &pattern-addr $2 &tick $1 &speed $1 &playing $1 ]
@Playback [ &position $2 &pattern-addr $2 &tick $1 &speed $1 &playing $1 &pattern-index $1 ] ( pattern-index = 0-127 which pattern is selected from the pattern table )
@Draw [ &row $1 &col $1
&pattern-x $2 &pattern-y $2
&pattern-vspacing $2 &pattern-hspacing $2
@ -59,7 +59,8 @@
( speed - how many ticks we play a note every )
#10 .Playback/speed STZ
;pattern .Playback/pattern-addr STZ2
#00 .Playback/pattern-index STZ
;update-pattern-addr JSR2
( display/audio init )
;on-frame .Screen/vector DEO2
@ -84,6 +85,10 @@ BRK
.Playback/pattern-addr LDZ2 #00 .Edit/selection-x LDZ ADD2 #00 .Edit/selection-y LDZ PTN_WIDTH MUL2 ADD2
RTN
@update-pattern-addr ( -- )
;pattern-table LDA2 .Playback/pattern-addr STZ2
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
@ -361,6 +366,9 @@ BRK
@playhead_icon [ 00 60 78 7e 7e 78 60 00 ]
@pointer_icon [ 80c0 e0f0 f8e0 1000 ]
@pattern-table :pattern $fe ( the pattern table is a list of pattern addresses in memory )
( pattern format - each note has 3 bytes. Pitch, instrument, volume. patterns are 0x10 long.
an ff in the note column of the pattern will kill the existing note without starting a new one (this is the tracker "box" note) )