Compare commits

...

2 Commits

Author SHA1 Message Date
Nico 9f6d534631 add pattern loading from table 2021-05-24 21:54:51 +01:00
Nico 9fe92b04a6 add pattern table and pointer 2021-05-23 20:39:31 +01:00
1 changed files with 13 additions and 3 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
@ -367,6 +374,9 @@ BRK
( 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) )
@data ( start of data )
@pattern_table :pattern $fd ( pattern table. Contains the addresses of patterns )
@pattern_pointer :pattern/end ( pattern pointer. Points to where the next pattern will be written in memory )
@pattern [
48 12 66
49 34 66
@ -383,5 +393,5 @@ BRK
54 00 66
ff 00 66
56 00 ff
57 00 66
]
57 00 66 &end
]