mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-02-12 08:32:08 +00:00
pt3_lib: merge in fix for when more than 42 patterns
to look up pattern you take the number, and multiply by 3 because there are 3 channels then by two as it's a 16-bit pointer. 43*3=129 and when you multiply by two it overflows 8-bit register hit this bug with the pt3 found in the second reality demo this fix isn't really optimal but seems to work
This commit is contained in:
parent
d4219e75e3
commit
cb0546ede7
@ -1564,18 +1564,48 @@ not_done:
|
|||||||
|
|
||||||
; set up the three pattern address pointers
|
; set up the three pattern address pointers
|
||||||
|
|
||||||
asl ; mul pattern offset by two, as word sized ; 2
|
; BUG BUG BUG
|
||||||
tay ; 2
|
; 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
|
; point PATTERN_H/PATTERN_L to the pattern address table
|
||||||
|
|
||||||
clc ; 2
|
; clc ; 2
|
||||||
lda PT3_LOC+PT3_PATTERN_LOC_L ; 4
|
; lda PT3_LOC+PT3_PATTERN_LOC_L ; 4
|
||||||
sta PATTERN_L ; 3
|
; 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
|
||||||
|
php ; save carry as we might generate two
|
||||||
|
clc
|
||||||
|
adc PATTERN_L
|
||||||
|
sta PATTERN_L
|
||||||
|
|
||||||
lda PT3_LOC+PT3_PATTERN_LOC_H ; 4
|
lda PT3_LOC+PT3_PATTERN_LOC_H ; 4
|
||||||
adc #>PT3_LOC ; assume page boundary ; 2
|
adc #>PT3_LOC ; assume page boundary ; 2
|
||||||
|
plp ; restore carry
|
||||||
|
adc #0
|
||||||
sta PATTERN_H ; 3
|
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
|
; First 16-bits points to the Channel A address
|
||||||
lda (PATTERN_L),Y ; 5+
|
lda (PATTERN_L),Y ; 5+
|
||||||
sta note_a+NOTE_ADDR_L ; 4
|
sta note_a+NOTE_ADDR_L ; 4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user