fix all the playhead/position issues

This commit is contained in:
Nico 2021-06-05 13:58:24 +01:00
parent 44314f248b
commit ab30f523fa
1 changed files with 5 additions and 5 deletions

View File

@ -330,7 +330,7 @@ RTN
&loop
.Draw/pattern-y LDZ2 .Screen/x DEO2
DUP2 ;draw-pattern-line JSR2
.Screen/y DEI2 #0008 ( .Draw/pattern-vspacing LDZ2 ADD2 ) ADD2 .Screen/y DEO2 ( add spacing between rows )
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2 ( add spacing between rows )
PTN_WIDTH ADD2 ( get the next byte in the pattern )
#01 .Draw/row LDZ ADD .Draw/row STZ
.Draw/row LDZ PTN_LEN LOB NEQ ,&loop JCN
@ -344,7 +344,7 @@ RTN
#20 .Screen/color DEO
.Playback/position LDZ2 #0000 EQU2 ,&end JCN
( draw new playhead )
.Draw/pattern-y LDZ2 .Playback/position LDZ2 #0004 MUL2 ADD2 #000b SUB2 DUP2 .Draw/playhead-y STZ2
.Draw/pattern-y LDZ2 .Playback/position LDZ2 #0008 MUL2 ADD2 #0008 SUB2 DUP2 .Draw/playhead-y STZ2
.Screen/y DEO2
;playhead_icon .Screen/addr DEO2
#21 .Screen/color DEO
@ -363,10 +363,10 @@ RTN
@on-step ( whenever a pattern step should be played )
PTN_WIDTH PTN_LEN MUL2 .Playback/position LDZ2 NEQ2 ,&continue JCN ( if we're at the end of the pattern, reset the counter )
PTN_LEN .Playback/position LDZ2 NEQ2 ,&continue JCN ( if we're at the end of the pattern, reset the counter )
#0000 .Playback/position STZ2
&continue
.Playback/position LDZ2 .Playback/pattern-addr LDZ2 ADD2 ( put pattern line address on the stack )
.Playback/position LDZ2 PTN_WIDTH MUL2 .Playback/pattern-addr LDZ2 ADD2 ( put pattern line address on the stack )
DUP2 VOL LDA .Audio0/volume DEO ( ln -- ) ( put the address of the pattern line on the stack )
NOTE LDA ( get the current note )
DUP #00 EQU ,&rest JCN ( if the note is 00, aka empty, skip playing it )
@ -375,7 +375,7 @@ RTN
&rest POP ( if the note is a 00, jump here. POP to clean up the stack )
&end
PTN_WIDTH .Playback/position LDZ2 ADD2 .Playback/position STZ2
#0001 .Playback/position LDZ2 ADD2 .Playback/position STZ2
;draw-playhead JSR2 ( update the playhead position )
RTN