second: blurgh found bug in pt3 player if more than 42 patterns

multiply by 3 for channels and by 2 for word offset and you overflow
8-bits :(

of course our pt3 player has 51 channels
This commit is contained in:
Vince Weaver 2023-11-01 00:36:45 -04:00
parent 162d2b07f5
commit 4d8b79c4f6

View File

@ -1541,18 +1541,44 @@ not_done:
; set up the three pattern address pointers
asl ; mul pattern offset by two, as word sized ; 2
tay ; 2
; BUG BUG BUG
; pattern offset can be bigger than 128, and if we multiply
; by two to get word size it will overflow
; for example I have a .pt3 where pattern #48 ($30*3=$90) is used
; asl ; mul pattern offset by two, as word sized ; 2
; tay ; 2
; point PATTERN_H/PATTERN_L to the pattern address table
clc ; 2
lda PT3_LOC+PT3_PATTERN_LOC_L ; 4
sta PATTERN_L ; 3
; clc ; 2
; lda PT3_LOC+PT3_PATTERN_LOC_L ; 4
; sta PATTERN_L ; 3
; lda PT3_LOC+PT3_PATTERN_LOC_H ; 4
; adc #>PT3_LOC ; assume page boundary ; 2
; sta PATTERN_H ; 3
clc
sta PATTERN_L
adc PT3_LOC+PT3_PATTERN_LOC_L
adc PATTERN_L
sta PATTERN_L
lda PT3_LOC+PT3_PATTERN_LOC_H ; 4
adc #>PT3_LOC ; assume page boundary ; 2
sta PATTERN_H ; 3
; clc
; tya
; adc PATTERN_L
; adc PATTERN_L
; sta PATTERN_L
; lda #0
; adc PATTERN_H
; sta PATTERN_H
ldy #0
; First 16-bits points to the Channel A address
lda (PATTERN_L),Y ; 5+
sta note_a+NOTE_ADDR_L ; 4