Fixing more bugs.

This commit is contained in:
Martin Haye 2014-03-17 12:01:13 -07:00
parent 14c006b521
commit 5b4046ca16

View File

@ -17,7 +17,7 @@
MAX_SEGS = 96 MAX_SEGS = 96
DO_COMP_CHECKSUMS = 1 ; during compression debugging DO_COMP_CHECKSUMS = 1 ; during compression debugging
DEBUG_DECOMP = 0 DEBUG_DECOMP = 1
; Zero page temporary variables ; Zero page temporary variables
tmp = $2 ; len 2 tmp = $2 ; len 2
@ -30,6 +30,7 @@ isCompressed = $B ; len 1
pSrc = $C ; len 2 pSrc = $C ; len 2
pDst = $E ; len 2 pDst = $E ; len 2
ucLen = $10 ; len 2 ucLen = $10 ; len 2
checksum = $12 ; len 1
; Memory buffers ; Memory buffers
fileBuf = $4000 ; len $400 fileBuf = $4000 ; len $400
@ -56,9 +57,6 @@ segNum: !byte 0
nextLdVec: jmp diskLoader nextLdVec: jmp diskLoader
curPartition: !byte 0 curPartition: !byte 0
partFileRef: !byte 0 partFileRef: !byte 0
!if DO_COMP_CHECKSUMS {
checksum: !byte 0
}
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
DEBUG = 1 DEBUG = 1
@ -1079,7 +1077,7 @@ disk_finishLoad: !zone
bcc + bcc +
inc .setMarkPos+2 ; account for partitions > 64K inc .setMarkPos+2 ; account for partitions > 64K
+ iny ; increment to next entry + iny ; increment to next entry
bmi + ; if Y index is is small, no need to adjust bpl + ; if Y index is is small, no need to adjust
jsr adjYpTmp ; adjust pTmp and Y to make it small again jsr adjYpTmp ; adjust pTmp and Y to make it small again
+ jmp .scan ; back for more + jmp .scan ; back for more
.prodosErr: .prodosErr:
@ -1265,7 +1263,7 @@ lz4Decompress: !zone
lda #0 ; have we finished all pages? lda #0 ; have we finished all pages?
bne .decodeMatch ; no, keep going bne .decodeMatch ; no, keep going
pla ; toss unused match length pla ; toss unused match length
!if DO_COMP_CHECKSUMS { jsr .verifyCksum } !if DO_COMP_CHECKSUMS { jsr .verifyCksum : +waitKey }
rts ; all done! rts ; all done!
; Now that we've finished with the literals, decode the match section ; Now that we've finished with the literals, decode the match section
.decodeMatch: .decodeMatch:
@ -1416,11 +1414,11 @@ setupDecomp:
tya tya
clc clc
adc pSrc adc pSrc
sta pTmp sta .dbgTmp
lda pSrc+1 lda pSrc+1
adc #0 adc #0
sta pTmp+1 sta .dbgTmp+1
+prWord pTmp +prWord .dbgTmp
+prStr : !text "len=",0 +prStr : !text "len=",0
+prWord ucLen +prWord ucLen
+crout +crout
@ -1429,11 +1427,11 @@ setupDecomp:
txa ; calculate src address with X (not Y!) as offset txa ; calculate src address with X (not Y!) as offset
clc clc
adc .srcLoad+1 adc .srcLoad+1
sta pTmp sta .dbgTmp
lda .srcLoad+2 lda .srcLoad+2
adc #0 adc #0
sta pTmp+1 sta .dbgTmp+1
+prWord pTmp +prWord .dbgTmp
+prStr : !text "dst=",0 +prStr : !text "dst=",0
txa ; calculate dest address with X as offset txa ; calculate dest address with X as offset
clc clc
@ -1446,18 +1444,18 @@ setupDecomp:
+prStr : !text "offset=",0 +prStr : !text "offset=",0
lda tmp ; now calculate the difference lda tmp ; now calculate the difference
sec sec
sbc pTmp sbc .dbgTmp
sta pTmp sta .dbgTmp
lda tmp+1 lda tmp+1
sbc pTmp+1 sbc .dbgTmp+1
sta pTmp+1 sta .dbgTmp+1
+prWord pTmp ; and print it +prWord .dbgTmp ; and print it
rts rts
.debug4 +prStr : !text "len=",0 .debug4 +prStr : !text "len=",0
+prWord ucLen +prWord ucLen
+crout +crout
+waitKey
rts rts
.dbgTmp !word 0
} }
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------