mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-01-07 23:31:27 +00:00
Moved and extended garbage-collected heap, to make more room for game items (and take advantage of newly freed space in F800.FFFF range.)
This commit is contained in:
parent
71895ed546
commit
243b6c362a
@ -282,7 +282,7 @@ init: !zone
|
||||
; 6: main $6000 -> 7, inactive
|
||||
; 7: main $BF00 -> 8, active + locked
|
||||
; 8: main $E000 -> 9, inactive
|
||||
; 9: main $F800 -> 0, active + locked
|
||||
; 9: main $FFFA -> 0, active + locked
|
||||
; First, the flags
|
||||
lda #$C0 ; flags for active + locked (with no resource)
|
||||
sta tSegType+0
|
||||
@ -325,7 +325,9 @@ init: !zone
|
||||
sta tSegAdrHi+6
|
||||
lda #$E0
|
||||
sta tSegAdrHi+8
|
||||
lda #$F8
|
||||
lda #$FA
|
||||
sta tSegAdrLo+9
|
||||
lda #$FF
|
||||
sta tSegAdrHi+9
|
||||
; Finally, form a long list of the remaining unused segments.
|
||||
ldx #10
|
||||
@ -1633,6 +1635,7 @@ outOfMemErr: !zone
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
reservedErr: !zone
|
||||
jsr printMem
|
||||
jsr inlineFatal : !text "DblAlloc", 0
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
@ -1803,7 +1806,7 @@ shared_scan: !zone
|
||||
+ rts
|
||||
|
||||
invalParam: !zone
|
||||
!if DEBUG { jsr printMem }
|
||||
jsr printMem
|
||||
jsr inlineFatal : !text "InvalParam", 0
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
@ -107,17 +107,16 @@ end
|
||||
asm copyHeap // params: dir (0=AuxtoMain, 1=MainToAux)
|
||||
+asmPlasm_bank2 1
|
||||
lsr ; direction bit to carry flag
|
||||
;sta setAuxZP ; FIXME: put back when heap moved to aux
|
||||
lda #$40
|
||||
bcs +
|
||||
lda #$F0 ; FIXME, should be $D0 after heap moved to aux
|
||||
lda #$EF ; $EF00 is start of heap (right after font engine)
|
||||
+ sta tmp+1
|
||||
eor #$B0 ; FIXME: should be #$90 after heap moved to aux ; $40->D0, or $D0->40
|
||||
eor #$AF ; $EF -> $40, $F0 -> $41, etc.
|
||||
sta pTmp+1
|
||||
ldy #0
|
||||
sty tmp
|
||||
sty pTmp
|
||||
ldx #8 ; FIXME to #$10
|
||||
ldx #$C
|
||||
- lda (tmp),y
|
||||
sta (pTmp),y
|
||||
iny
|
||||
@ -126,7 +125,6 @@ asm copyHeap // params: dir (0=AuxtoMain, 1=MainToAux)
|
||||
inc pTmp+1
|
||||
dex
|
||||
bne -
|
||||
;sta clrAuxZP ; FIXME: put back when heap moved to aux
|
||||
rts
|
||||
end
|
||||
|
||||
@ -203,7 +201,7 @@ def _saveGame()
|
||||
// Write the game data to it
|
||||
write_fileref = open_fileref
|
||||
write_addr = $4000
|
||||
write_length = $800 // FIXME
|
||||
write_length = HEAP_SIZE
|
||||
guaranteeMLI(MLI_WRITE, @write_params)
|
||||
|
||||
// All done.
|
||||
@ -216,22 +214,20 @@ def loadInternal()
|
||||
word p_loaded
|
||||
mmgr(FINISH_LOAD, WITH_CLOSE)
|
||||
|
||||
// Open the file
|
||||
// Open the file. If that fails, return FALSE (instead of halting)
|
||||
open_filename = @game1_filename
|
||||
open_buffer = $5000
|
||||
if callMLI(MLI_OPEN, @open_params) > 0
|
||||
return FALSE
|
||||
else
|
||||
// Read the game data from it
|
||||
read_fileref = open_fileref
|
||||
read_addr = $4000
|
||||
read_length = $800 // FIXME
|
||||
guaranteeMLI(MLI_READ, @read_params)
|
||||
if callMLI(MLI_OPEN, @open_params) > 0; return FALSE; fin
|
||||
|
||||
// All done with the file
|
||||
close_fileref = open_fileref
|
||||
guaranteeMLI(MLI_CLOSE, @close_params)
|
||||
fin
|
||||
// Read the game data from it
|
||||
read_fileref = open_fileref
|
||||
read_addr = $4000
|
||||
read_length = $800 // FIXME
|
||||
guaranteeMLI(MLI_READ, @read_params)
|
||||
|
||||
// All done with the file
|
||||
close_fileref = open_fileref
|
||||
guaranteeMLI(MLI_CLOSE, @close_params)
|
||||
|
||||
// Copy the heap up, and init it with the correct size.
|
||||
p_loaded = $4000
|
||||
|
@ -2269,7 +2269,7 @@ export def initHeap(loadedSize)
|
||||
mmgr(HEAP_ADD_TYPE, typeTbls[i])
|
||||
i = i+1
|
||||
loop
|
||||
typeHash = hashBuffer(@typeTbl_Global, @typeTbls - @typeTbl_Global)
|
||||
typeHash = hashBuffer(@typeTbl_Global, @typeTbls - @typeTbl_Global) ^ HEAP_BOTTOM
|
||||
if loadedSize <> 0
|
||||
global = HEAP_BOTTOM
|
||||
if global=>w_typeHash <> typeHash
|
||||
|
@ -63,8 +63,8 @@ const WITH_CLOSE = 0
|
||||
const LEAVE_OPEN = 1
|
||||
|
||||
// Heap location in memory
|
||||
const HEAP_BOTTOM = $F000
|
||||
const HEAP_SIZE = $800
|
||||
const HEAP_BOTTOM = $EF00
|
||||
const HEAP_SIZE = $C00
|
||||
|
||||
// Event code
|
||||
const EVENT_ENTER = 1
|
||||
|
Loading…
Reference in New Issue
Block a user