Load working better.

This commit is contained in:
Martin Haye 2016-06-24 06:12:45 -07:00
parent 45ab9bafe2
commit 0e94a6fbb0
2 changed files with 6 additions and 3 deletions

View File

@ -176,7 +176,6 @@ def _saveGame()
// Perform garbage collection and record the size of the heap so we can restore it correctly
global=>w_heapSize = mmgr(HEAP_COLLECT, 0) - HEAP_BOTTOM
printf1("heapSize=$%x\n", global=>w_heapSize)
// Copy data to main memory
mmgr(FINISH_LOAD, WITH_CLOSE)
@ -234,8 +233,8 @@ def loadInternal()
// Init the heap with the correct size
p_loaded = $4000
printf1("Loaded heap size: $%x\n", p_loaded=>w_heapSize)
initHeap(p_loaded=>w_heapSize)
global = getGlobals()
// Now copy the data back up to the heap space, and we're done
copyHeap(1) // main to aux

View File

@ -2074,7 +2074,11 @@ def _initHeap(loadedSize)
mmgr(HEAP_ADD_TYPE, typeTbls[i])
i = i+1
loop
global = mmgr(HEAP_ALLOC, TYPE_GLOBAL)
if loadedSize <> 0
global = HEAP_BOTTOM
else
global = mmgr(HEAP_ALLOC, TYPE_GLOBAL)
fin
end
///////////////////////////////////////////////////////////////////////////////////////////////////