mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-07-04 09:29:28 +00:00
Made debug mode more compact in mem mgr.
This commit is contained in:
parent
7e6308e994
commit
1d2ee3ad13
@ -273,7 +273,7 @@ init: !zone
|
|||||||
cpx #MAX_SEGS-1 ; did all segments yet?
|
cpx #MAX_SEGS-1 ; did all segments yet?
|
||||||
bne .loop ; no, loop again
|
bne .loop ; no, loop again
|
||||||
; Allocate space for the PLASMA frame stack
|
; Allocate space for the PLASMA frame stack
|
||||||
!if DEBUG {
|
!if DEBUG >= 2 {
|
||||||
lda #$20
|
lda #$20
|
||||||
sta framePtr+1 ; because sanity check verifies it's not $BE or $BF
|
sta framePtr+1 ; because sanity check verifies it's not $BE or $BF
|
||||||
}
|
}
|
||||||
@ -987,7 +987,7 @@ gc2_sweep: !zone
|
|||||||
closePartFile: !zone
|
closePartFile: !zone
|
||||||
lda partFileOpen ; check if open
|
lda partFileOpen ; check if open
|
||||||
beq .done
|
beq .done
|
||||||
!if DEBUG { +prStr : !text "ClosePart.",0 }
|
!if DEBUG >= 2 { +prStr : !text "ClosePart.",0 }
|
||||||
dec partFileOpen
|
dec partFileOpen
|
||||||
.done rts
|
.done rts
|
||||||
|
|
||||||
@ -1289,7 +1289,7 @@ dispatch:
|
|||||||
rol ; transfer carry bit
|
rol ; transfer carry bit
|
||||||
sta isAuxCmd ; to isAuxCmd
|
sta isAuxCmd ; to isAuxCmd
|
||||||
pla
|
pla
|
||||||
!if DEBUG { jsr saneStart : jsr + : jmp saneEnd }
|
!if DEBUG >= 1 { jsr saneStart : jsr + : jmp saneEnd }
|
||||||
+ cmp #REQUEST_MEMORY
|
+ cmp #REQUEST_MEMORY
|
||||||
bne +
|
bne +
|
||||||
jmp mem_request
|
jmp mem_request
|
||||||
@ -1350,7 +1350,7 @@ dispatch:
|
|||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
; Debug-mode sanity checking
|
; Debug-mode sanity checking
|
||||||
!if DEBUG {
|
!if DEBUG >= 1 {
|
||||||
saneStart: !zone {
|
saneStart: !zone {
|
||||||
sta saneEnd+2 ; save cmd num for end-checking
|
sta saneEnd+2 ; save cmd num for end-checking
|
||||||
cmp #ADVANCE_ANIMS
|
cmp #ADVANCE_ANIMS
|
||||||
@ -1607,7 +1607,7 @@ shared_alloc:
|
|||||||
; at the same time to guarantee that we never have the main part of a module
|
; at the same time to guarantee that we never have the main part of a module
|
||||||
; without its aux part, or vice versa.
|
; without its aux part, or vice versa.
|
||||||
reclaim: !zone
|
reclaim: !zone
|
||||||
!if DEBUG { +prStr : !text "Reclaim.",0 }
|
!if DEBUG >= 2 { +prStr : !text "Reclaim.",0 }
|
||||||
lda isAuxCmd ; save whether current command is aux or not
|
lda isAuxCmd ; save whether current command is aux or not
|
||||||
pha
|
pha
|
||||||
lda #1 ; we do aux bank first
|
lda #1 ; we do aux bank first
|
||||||
@ -1640,7 +1640,7 @@ coalesce: !zone
|
|||||||
ora tSegType,y ; and next seg
|
ora tSegType,y ; and next seg
|
||||||
bne .next ; if either is active or has a type, can't combine
|
bne .next ; if either is active or has a type, can't combine
|
||||||
; we can combine the next segment into this one.
|
; we can combine the next segment into this one.
|
||||||
!if DEBUG >= 3 { jsr .debug }
|
!if DEBUG >= 4 { jsr .debug }
|
||||||
lda tSegLink,y
|
lda tSegLink,y
|
||||||
sta tSegLink,x
|
sta tSegLink,x
|
||||||
stx tmp
|
stx tmp
|
||||||
@ -1650,7 +1650,7 @@ coalesce: !zone
|
|||||||
tax ; to X reg index
|
tax ; to X reg index
|
||||||
bne .loop ; non-zero = not end of chain - loop again
|
bne .loop ; non-zero = not end of chain - loop again
|
||||||
.done rts
|
.done rts
|
||||||
!if DEBUG >= 3 {
|
!if DEBUG >= 4 {
|
||||||
.debug +prStr : !text "Coalesce ",0
|
.debug +prStr : !text "Coalesce ",0
|
||||||
pha
|
pha
|
||||||
txa
|
txa
|
||||||
@ -1975,7 +1975,7 @@ calcBufferDigest: !zone
|
|||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
openPartition: !zone
|
openPartition: !zone
|
||||||
!if DEBUG { +prStr : !text "OpenPart ",0 : +prByte curPartition : +crout }
|
!if DEBUG >= 2 { +prStr : !text "OpenPart ",0 : +prByte curPartition : +crout }
|
||||||
; Make sure to read header into main mem, even if outer cmd is aux
|
; Make sure to read header into main mem, even if outer cmd is aux
|
||||||
lda isAuxCmd
|
lda isAuxCmd
|
||||||
pha
|
pha
|
||||||
@ -2124,7 +2124,7 @@ disk_queueLoad: !zone
|
|||||||
lda (pTmp),y ; and hi byte
|
lda (pTmp),y ; and hi byte
|
||||||
+ stx reqLen ; save the uncompressed length
|
+ stx reqLen ; save the uncompressed length
|
||||||
sta reqLen+1 ; both bytes
|
sta reqLen+1 ; both bytes
|
||||||
!if DEBUG >= 2 { +prStr : !text "ucLen=",0 : +prWord reqLen : +crout }
|
!if DEBUG >= 3 { +prStr : !text "ucLen=",0 : +prWord reqLen : +crout }
|
||||||
; Load the bytecode of the gamelib (first) bytecode module at the highest possible point
|
; Load the bytecode of the gamelib (first) bytecode module at the highest possible point
|
||||||
; (to reduce fragmentation of the rest of aux mem)
|
; (to reduce fragmentation of the rest of aux mem)
|
||||||
lda resType
|
lda resType
|
||||||
@ -2260,7 +2260,7 @@ disk_finishLoad: !zone
|
|||||||
beq + ; not aux, skip
|
beq + ; not aux, skip
|
||||||
inc isAuxCmd ; set aux flag
|
inc isAuxCmd ; set aux flag
|
||||||
+ sty .ysave ; Save Y so we can resume scanning later.
|
+ sty .ysave ; Save Y so we can resume scanning later.
|
||||||
!if DEBUG { jsr .debug1 }
|
!if DEBUG >= 1 { jsr .debug1 }
|
||||||
jsr disk_seek ; move the file pointer to the current block
|
jsr disk_seek ; move the file pointer to the current block
|
||||||
ldy .ysave
|
ldy .ysave
|
||||||
lda (pTmp),y ; grab resource length on disk
|
lda (pTmp),y ; grab resource length on disk
|
||||||
@ -2283,7 +2283,7 @@ disk_finishLoad: !zone
|
|||||||
ldy tSegAdrHi,x ; hi byte too
|
ldy tSegAdrHi,x ; hi byte too
|
||||||
sta pDst ; and save it for later
|
sta pDst ; and save it for later
|
||||||
sty pDst+1
|
sty pDst+1
|
||||||
!if DEBUG { jsr .debug2 }
|
!if DEBUG >= 1 { jsr .debug2 }
|
||||||
plp ; retrieve isCompressed flag
|
plp ; retrieve isCompressed flag
|
||||||
bmi .readAndDecomp ; if so, go do read/decompress thing
|
bmi .readAndDecomp ; if so, go do read/decompress thing
|
||||||
lda #cmdread ; else, just read.
|
lda #cmdread ; else, just read.
|
||||||
@ -2346,7 +2346,7 @@ disk_finishLoad: !zone
|
|||||||
; Now read the raw (compressed) data
|
; Now read the raw (compressed) data
|
||||||
lda #cmdread
|
lda #cmdread
|
||||||
jsr readAndAdj
|
jsr readAndAdj
|
||||||
!if DEBUG { jsr .debug3 }
|
!if DEBUG >= 1 { jsr .debug3 }
|
||||||
; Stuff was read to into pDst. Now that becomes the source. Decompressor is set up
|
; Stuff was read to into pDst. Now that becomes the source. Decompressor is set up
|
||||||
; to decompress *from* our pDst to our pSrc. Its labels are swapped.
|
; to decompress *from* our pDst to our pSrc. Its labels are swapped.
|
||||||
ldx isAuxCmd
|
ldx isAuxCmd
|
||||||
@ -2367,7 +2367,7 @@ disk_finishLoad: !zone
|
|||||||
.ysave: !byte 0
|
.ysave: !byte 0
|
||||||
.nFixups: !byte 0
|
.nFixups: !byte 0
|
||||||
|
|
||||||
!if DEBUG {
|
!if DEBUG >= 1 {
|
||||||
.debug1:+prStr : !text "Ld t=",0
|
.debug1:+prStr : !text "Ld t=",0
|
||||||
pha
|
pha
|
||||||
lda resType
|
lda resType
|
||||||
@ -2397,6 +2397,22 @@ disk_finishLoad: !zone
|
|||||||
+prStr : !text "end=",0
|
+prStr : !text "end=",0
|
||||||
+prWord pEnd
|
+prWord pEnd
|
||||||
+crout
|
+crout
|
||||||
|
|
||||||
|
;FIXME FOO
|
||||||
|
php
|
||||||
|
pha
|
||||||
|
lda resType
|
||||||
|
cmp #5
|
||||||
|
bne +
|
||||||
|
lda resNum
|
||||||
|
cmp #$27
|
||||||
|
bne +
|
||||||
|
lda #$60
|
||||||
|
sta 0
|
||||||
|
jsr 0
|
||||||
|
+ pla
|
||||||
|
plp
|
||||||
|
|
||||||
rts
|
rts
|
||||||
} ; end DEBUG
|
} ; end DEBUG
|
||||||
|
|
||||||
@ -2421,7 +2437,7 @@ lz4Decompress: !zone
|
|||||||
; Apply fixups to all modules that were loaded this round, and free the fixup
|
; Apply fixups to all modules that were loaded this round, and free the fixup
|
||||||
; resources from memory.
|
; resources from memory.
|
||||||
doAllFixups: !zone
|
doAllFixups: !zone
|
||||||
!if DEBUG >= 3 { +prStr : !text "Doing all fixups.",0 }
|
!if DEBUG >= 4 { +prStr : !text "Doing all fixups.",0 }
|
||||||
; Now scan aux mem for fixup segments
|
; Now scan aux mem for fixup segments
|
||||||
cli ; prevent interrupts while we mess around in aux mem
|
cli ; prevent interrupts while we mess around in aux mem
|
||||||
ldx #1 ; start at first aux mem segment (0=main mem, 1=aux)
|
ldx #1 ; start at first aux mem segment (0=main mem, 1=aux)
|
||||||
@ -2470,7 +2486,7 @@ doAllFixups: !zone
|
|||||||
lda tSegAdrHi,x
|
lda tSegAdrHi,x
|
||||||
sta .auxBase+1
|
sta .auxBase+1
|
||||||
|
|
||||||
!if DEBUG >= 3 { jsr .debug1 }
|
!if DEBUG >= 4 { jsr .debug1 }
|
||||||
|
|
||||||
; Process the fixups
|
; Process the fixups
|
||||||
.proc jsr .fetchFixup ; get key byte
|
.proc jsr .fetchFixup ; get key byte
|
||||||
@ -2489,7 +2505,7 @@ doAllFixups: !zone
|
|||||||
and #$3F ; mask off the flags
|
and #$3F ; mask off the flags
|
||||||
adc .mainBase+1
|
adc .mainBase+1
|
||||||
sta pDst+1
|
sta pDst+1
|
||||||
!if DEBUG >= 3 { jsr .debug2 }
|
!if DEBUG >= 4 { jsr .debug2 }
|
||||||
clc
|
clc
|
||||||
jsr .adMain ; recalc and store lo byte
|
jsr .adMain ; recalc and store lo byte
|
||||||
iny
|
iny
|
||||||
@ -2510,7 +2526,7 @@ doAllFixups: !zone
|
|||||||
and #$3F ; mask off the flags
|
and #$3F ; mask off the flags
|
||||||
adc .auxBase+1
|
adc .auxBase+1
|
||||||
sta pDst+1
|
sta pDst+1
|
||||||
!if DEBUG >= 3 { jsr .debug3 }
|
!if DEBUG >= 4 { jsr .debug3 }
|
||||||
sta setAuxWr
|
sta setAuxWr
|
||||||
jsr .adAux ; recalc and store lo byte
|
jsr .adAux ; recalc and store lo byte
|
||||||
iny
|
iny
|
||||||
@ -2543,7 +2559,7 @@ doAllFixups: !zone
|
|||||||
cmp #$03
|
cmp #$03
|
||||||
bne .resume ; not a stub, resume scanning
|
bne .resume ; not a stub, resume scanning
|
||||||
; found a stub, adjust it.
|
; found a stub, adjust it.
|
||||||
!if DEBUG >= 3 { jsr .debug4 }
|
!if DEBUG >= 4 { jsr .debug4 }
|
||||||
clc
|
clc
|
||||||
ldx #0
|
ldx #0
|
||||||
jsr .adStub
|
jsr .adStub
|
||||||
@ -2575,7 +2591,7 @@ doAllFixups: !zone
|
|||||||
bne +
|
bne +
|
||||||
inc pSrc+1 ; hi byte too, if necessary
|
inc pSrc+1 ; hi byte too, if necessary
|
||||||
+ rts
|
+ rts
|
||||||
!if DEBUG >= 3 {
|
!if DEBUG >= 4 {
|
||||||
.debug1 +prStr : !text "Found fixup, res=",0
|
.debug1 +prStr : !text "Found fixup, res=",0
|
||||||
+prByte resNum
|
+prByte resNum
|
||||||
+prStr : !text "mainBase=",0
|
+prStr : !text "mainBase=",0
|
||||||
@ -2737,7 +2753,7 @@ advSingleAnim:
|
|||||||
iny ; now y=3, index current frame number
|
iny ; now y=3, index current frame number
|
||||||
lda (tmp),y
|
lda (tmp),y
|
||||||
sta .curFrame ; save it for comparison later
|
sta .curFrame ; save it for comparison later
|
||||||
!if DEBUG = 2 { jsr .dbgB1 }
|
!if DEBUG >= 3 { jsr .dbgB1 }
|
||||||
|
|
||||||
.chkr ldy #0
|
.chkr ldy #0
|
||||||
lda (tmp),y ; get animation type (1=Forward, 2=Forward/Backward, 3=Forward+Stop, 4=Random)
|
lda (tmp),y ; get animation type (1=Forward, 2=Forward/Backward, 3=Forward+Stop, 4=Random)
|
||||||
@ -2792,13 +2808,13 @@ advSingleAnim:
|
|||||||
lda #0 ; back to start
|
lda #0 ; back to start
|
||||||
+ iny ; index of current frame number
|
+ iny ; index of current frame number
|
||||||
sta (tmp),y ; and store it
|
sta (tmp),y ; and store it
|
||||||
!if DEBUG = 2 { jsr .dbgB2 }
|
!if DEBUG >= 3 { jsr .dbgB2 }
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.curFrame !byte 0
|
.curFrame !byte 0
|
||||||
.maxFrame !byte 0
|
.maxFrame !byte 0
|
||||||
|
|
||||||
!if DEBUG = 2 {
|
!if DEBUG >= 3 {
|
||||||
.dbgin sta clrAuxRd
|
.dbgin sta clrAuxRd
|
||||||
sta clrAuxWr
|
sta clrAuxWr
|
||||||
bit $c051
|
bit $c051
|
||||||
@ -2831,7 +2847,7 @@ applyPatch:
|
|||||||
tax ; patch zero?
|
tax ; patch zero?
|
||||||
beq .done ; if so, nothing to do
|
beq .done ; if so, nothing to do
|
||||||
sta reqLen ; index of patch number to find
|
sta reqLen ; index of patch number to find
|
||||||
!if DEBUG = 2 { jsr .dbgC1 }
|
!if DEBUG >= 3 { jsr .dbgC1 }
|
||||||
|
|
||||||
ldx #3
|
ldx #3
|
||||||
- lda tmp,x ; copy pointers to load/store data: tmp->pSrc, pTmp->pDst
|
- lda tmp,x ; copy pointers to load/store data: tmp->pSrc, pTmp->pDst
|
||||||
@ -2857,7 +2873,7 @@ applyPatch:
|
|||||||
pla ; get lo byte of len back
|
pla ; get lo byte of len back
|
||||||
jsr .srcadd ; skip pSrc past last partial page in patch
|
jsr .srcadd ; skip pSrc past last partial page in patch
|
||||||
jmp -
|
jmp -
|
||||||
+ !if DEBUG = 2 { jsr .dbgC2 }
|
+ !if DEBUG >= 3 { jsr .dbgC2 }
|
||||||
|
|
||||||
; pSrc now points at the patch to apply
|
; pSrc now points at the patch to apply
|
||||||
; pDst now points at the base data to modify
|
; pDst now points at the base data to modify
|
||||||
@ -2903,7 +2919,7 @@ applyPatch:
|
|||||||
inc 1,x
|
inc 1,x
|
||||||
+ rts
|
+ rts
|
||||||
|
|
||||||
!if DEBUG = 2 {
|
!if DEBUG >= 3 {
|
||||||
.dbgC1 jsr .dbgin
|
.dbgC1 jsr .dbgin
|
||||||
+prStr : !text "apply ",0
|
+prStr : !text "apply ",0
|
||||||
+prByte reqLen
|
+prByte reqLen
|
||||||
|
Loading…
Reference in New Issue
Block a user