mirror of
https://github.com/badvision/lawless-legends.git
synced 2026-10-22 06:02:55 +00:00
Fixed a giant bug in the buffer digest algorithm, and re-enabled it. Also added some nice mixing that I hadn't thought of before. This speeds up floppy mode alot. It ain't fast, but it's a lot faster than without the digest.
This commit is contained in:
1 parent
467911b7f5
commit
7dc59febee
1 file changed
+60
-55
@@ -1108,7 +1108,7 @@ partFileOpen: !byte 0
|
||||
curMarkPos: !fill 3
|
||||
setMarkPos: !fill 3
|
||||
nSegsQueued: !byte 0
|
||||
;bufferDigest: !fill 4
|
||||
bufferDigest: !fill 4
|
||||
diskActState: !byte 0
|
||||
floppyDrive: !byte 0
|
||||
|
||||
@@ -1939,63 +1939,68 @@ diskLoader: !zone
|
||||
; out ok, resulting in a crash. Taking out the digest stuff for now.
|
||||
; !! END NOTE !!
|
||||
;
|
||||
; calcBufferDigest: !zone
|
||||
; lda #>headerBuf
|
||||
; sta .ld1+2
|
||||
; sta .ld3+2
|
||||
; lda #>headerBuf+$A00
|
||||
; sta .ld2+2
|
||||
; sta .ld4+2
|
||||
; ldy #0
|
||||
; sty tmp
|
||||
; sty tmp+1
|
||||
; sty tmp+2
|
||||
; sty tmp+3
|
||||
; ldx #6 ; sum 6 pages in each area - covers first part of heap collect zone also
|
||||
; clc
|
||||
; .sum lda tmp
|
||||
; rol
|
||||
; .ld1 adc $1000,y ; high byte self-modified earlier
|
||||
; sta tmp
|
||||
calcBufferDigest: !zone
|
||||
lda #>headerBuf
|
||||
sta .ld1+2
|
||||
sta .ld3+2
|
||||
lda #>headerBuf+$A00
|
||||
sta .ld2+2
|
||||
sta .ld4+2
|
||||
ldy #0
|
||||
sty tmp
|
||||
sty tmp+1
|
||||
sty tmp+2
|
||||
sty tmp+3
|
||||
ldx #6 ; sum 6 pages in each area - covers first part of heap collect zone also
|
||||
clc
|
||||
.nxtpg ldy #0
|
||||
.sum lda tmp
|
||||
rol
|
||||
.ld1 adc $1000,y ; high byte self-modified earlier
|
||||
eor tmp+1
|
||||
sta tmp
|
||||
|
||||
; lda tmp+1
|
||||
; rol
|
||||
; .ld2 adc $1000,y ; high byte self-modified earlier
|
||||
; sta tmp+1
|
||||
lda tmp+1
|
||||
rol
|
||||
.ld2 adc $1000,y ; high byte self-modified earlier
|
||||
eor tmp+2
|
||||
sta tmp+1
|
||||
|
||||
; lda tmp+2
|
||||
; rol
|
||||
; .ld3 adc $1080,y ; high byte self-modified earlier
|
||||
; sta tmp+2
|
||||
lda tmp+2
|
||||
rol
|
||||
.ld3 adc $1080,y ; high byte self-modified earlier
|
||||
eor tmp+3
|
||||
sta tmp+2
|
||||
|
||||
; lda tmp+3
|
||||
; rol
|
||||
; .ld4 adc $1080,y ; high byte self-modified earlier
|
||||
; sta tmp+3
|
||||
lda tmp+3
|
||||
rol
|
||||
.ld4 adc $1080,y ; high byte self-modified earlier
|
||||
eor tmp
|
||||
sta tmp+3
|
||||
|
||||
; iny
|
||||
; iny
|
||||
; bpl .sum ; every even offset 0..126
|
||||
iny
|
||||
iny
|
||||
bpl .sum ; every even offset 0..126
|
||||
|
||||
; inc .ld1+2 ; go to next page
|
||||
; inc .ld2+2
|
||||
; inc .ld3+2
|
||||
; inc .ld4+2
|
||||
; dex
|
||||
; bne .ld1
|
||||
inc .ld1+2 ; go to next page
|
||||
inc .ld2+2
|
||||
inc .ld3+2
|
||||
inc .ld4+2
|
||||
dex
|
||||
bne .nxtpg
|
||||
|
||||
; ; Now compare with the old digest, and replace the old digest.
|
||||
; .cmp ldy #0
|
||||
; ldx #3
|
||||
; - lda tmp,x
|
||||
; cmp bufferDigest,x
|
||||
; beq +
|
||||
; iny
|
||||
; + sta bufferDigest,x
|
||||
; dex
|
||||
; bpl -
|
||||
; cpy #0 ; Y=0 if new digest equals old digest
|
||||
; rts
|
||||
; Now compare with the old digest, and replace the old digest.
|
||||
.cmp ldy #0
|
||||
ldx #3
|
||||
- lda tmp,x
|
||||
cmp bufferDigest,x
|
||||
beq +
|
||||
iny
|
||||
+ sta bufferDigest,x
|
||||
dex
|
||||
bpl -
|
||||
cpy #0 ; Y=0 if new digest equals old digest
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
openPartition: !zone
|
||||
@@ -2090,8 +2095,8 @@ disk_startLoad: !zone
|
||||
bne .new ; if different, close the old one
|
||||
lda partFileOpen
|
||||
beq .done ; if nothing already open, we're okay with that.
|
||||
;jsr calcBufferDigest ; same partition - check that buffers are still intact
|
||||
;beq .done ; if correct partition file already open, we're done.
|
||||
jsr calcBufferDigest ; same partition - check that buffers are still intact
|
||||
beq .done ; if correct partition file already open, we're done.
|
||||
.new lda nSegsQueued ; make sure nothing queued before switching
|
||||
bne sequenceError
|
||||
jsr closePartFile
|
||||
@@ -2274,7 +2279,7 @@ disk_finishLoad: !zone
|
||||
.scan: lda (pTmp),y ; get resource type byte
|
||||
bne .notdone ; zero = end of header
|
||||
; At the end, record new buffer digest, and perform all fixups
|
||||
;jsr calcBufferDigest
|
||||
jsr calcBufferDigest
|
||||
lda .nFixups ; any fixups encountered?
|
||||
beq .done
|
||||
jsr doAllFixups ; found fixups - execute and free them
|
||||
|
||||
Reference in new issue
Block a user