Realized I could use simple PLASMA extern for global heap pointer.

This commit is contained in:
Martin Haye 2017-01-22 08:44:10 -08:00
parent 421807719b
commit 9e5e955fbe
10 changed files with 17 additions and 38 deletions

View File

@ -2408,8 +2408,6 @@ end
out.println("include \"gen_items.plh\"")
out.println("include \"gen_players.plh\"")
out.println()
out.println("word global")
out.println()
// Pre-define all the creation functions
out.println("predef _makeInitialParty")
@ -2469,7 +2467,6 @@ end
out.println("end\n")
// Lastly, the outer module-level code
out.println("global = getGlobals()")
out.println("return @funcTbl")
out.println("done")
}
@ -2847,7 +2844,6 @@ end
out << "include \"../plasma/gen_items.plh\"\n"
out << "include \"../plasma/gen_modules.plh\"\n"
out << "include \"../plasma/gen_players.plh\"\n\n"
out << "word global\n"
}
/**
@ -2863,7 +2859,6 @@ end
packScript(script)
// Set up the pointer to global vars and finish up the module.
out << "global = getGlobals()\n"
if (script.block.size() == 0)
out << "return 0\n"
else
@ -3615,9 +3610,6 @@ end
if (script)
packScript(script)
// Set up the pointer to global vars
out << "global = getGlobals()\n"
// Code to register the map name, trigger table, and map extent.
def shortName = mapName.replaceAll(/[\s-]*[23][dD][-0-9]*$/, '').take(16)
out << "setScriptInfo(\"$shortName\", @triggerTbl, $maxX, $maxY)\n"

View File

@ -1757,3 +1757,8 @@ HgrTbLo !byte $00,$00,$00,$00,$00,$00,$00,$00
!byte $D0,$D0,$D0,$D0,$D0,$D0,$D0,$D0
!byte $50,$50,$50,$50,$50,$50,$50,$50
!byte $D0,$D0,$D0,$D0,$D0,$D0,$D0,$D0
; Be careful not to grow past the size of our designated area in the LC
!if (* - fontEngine) > fontEngineLen {
!error "Font engine grew too large."
}

View File

@ -14,6 +14,7 @@
;
fontEngine = $EC00
fontEngineLen = $F00 ; maximum (allows for some debug code)
SetFont = fontEngine
SetWindow = SetFont+3
ClearWindow = SetWindow+3

View File

@ -52,17 +52,19 @@
; 0800.0Cxx memory manager part 1
; 0Cxx.0Exx PLASMA locals storage (length $200)
; 0Exx.17xx gameloop asm, data and stubs
; 17xx.1FFF (free)
; 17xx.1FFF (free, managed)
; 2000.3FFF hi-res page 1
; 4000.5FFF hi-res page 2 /
; memory manager work space
; 6000.6xxx 2D or 3D renderer
; 7xxx.BFFF (free)
; 7xxx.BFFF (free, managed)
; C000.CFFF I/O
; (bank 1) D000.DEFF memory manager part 2
; (bank 1) DF00.DFFF decompressor
; (bank 2) D000.D9FF PLASMA runtime
; (bank 2) DA00.DFFF (unused)
; Note: Memory manager can't load any resources directly into LC space,
; because ProRWTS is in aux LC and thus can't write to the main LC.
; E000.EBFF small-object heap
; EC00.FAFF font engine
; FB00.FFF9 font data
@ -74,7 +76,7 @@
; 0200.03FF (currently unused)
; 0400.07FF (unused, but screen holes overwritten by hard drive C7xx ROM)
; 0800.0D7A texture expander part 1 (used by 3D renderer)
; 0D7B.9xxx (free)
; 0D7B.9xxx (free, managed)
; A0xx.BFFF gameloop PLASMA code (loaded as high as possible)
; C000.CFFF I/O
; (bank 1) D000.DAFF ProRWTS runtime

View File

@ -16,7 +16,6 @@ include "gen_enemies.plh"
include "gen_modules.plh"
include "combat.plh"
word global
predef _combat_zoneEncounter
word[] funcTbl = @_combat_zoneEncounter
@ -636,6 +635,5 @@ end
///////////////////////////////////////////////////////////////////////////////////////////////////
// initialization code
global = getGlobals()
return @funcTbl
done

View File

@ -27,10 +27,6 @@ const RWTS_OPENDIR = (1<<8)
const LOAD_SAVE_BUF = $5000
// This pointer is the root of all heap-tracked (and garbage collected) objects.
// See playtype.plh for definitions of all the datastructures and how they interconnect.
word global
// Exported functions go here. First a predef for each one, then a table with function pointers
// in the same order as the constants are defined in the the header.
predef _saveGame, _loadGame, _newOrLoadGame
@ -248,7 +244,6 @@ def loadInternal()
fin
memcpy(LOAD_SAVE_BUF, HEAP_BOTTOM, HEAP_SIZE) // low mem to LC
initHeap(p_loaded=>w_heapSize)
global = getGlobals()
return TRUE
end
@ -270,7 +265,6 @@ end
def newGame()
word playersModule, newGameModule
initHeap(0) // initially empty heap
global = getGlobals()
global->b_curAvatar = 0
mmgr(START_LOAD, 1) // players module and new game module both in partition 1
playersModule = mmgr(QUEUE_LOAD, MOD_GEN_PLAYERS<<8 | RES_TYPE_MODULE)
@ -332,6 +326,5 @@ end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Boilerplate module initialization code
global = getGlobals()
return @funcTbl
done

View File

@ -14,7 +14,7 @@ import gamelib
predef setScriptInfo, scriptDisplayStr, scriptDisplayStrNL, getYN, queue_setMap
predef setSky, setGround, queue_teleport, setPortrait, clearPortrait, moveWayBackward
predef flipToPage1, textHome, calcWidth
predef getUpperKey, clearWindow, getGlobals, rand16, printf1, printf2, printf3
predef getUpperKey, clearWindow, rand16, printf1, printf2, printf3
predef displayf1, displayf2, displayf3, buildString, addToString, finishString, printHex
predef displayChar, rawDisplayStr, displayStr, rightJustifyStr, rightJustifyNum, puts
predef min, max, randomFromListFiltered, randomFromArray, scanForNamedObj
@ -31,6 +31,10 @@ import gamelib
predef scriptSwapTile, setIntimateMode, fontCmd, setIntimateMode
predef callGlobalFunc, getCharResponse, memcpy
// This pointer is the root of all heap-tracked (and garbage collected) objects.
// See playtype.plh for definitions of all the datastructures and how they interconnect.
word global
/////////// Shared string constants //////////////
// First: attributes
@ -39,5 +43,4 @@ import gamelib
// Next: common events
byte[] S_ENTER, S_LEAVE, S_USE
end

View File

@ -47,7 +47,7 @@ include "intimate.plh"
// Data structures
include "playtype.pla"
word global // the global heap object, from which all live objects must be reachable
export word global // the global heap object, from which all live objects must be reachable
///////////////////////////////////////////////////////////////////////////////////////////////////
// Predefined functions, for circular calls or out-of-order calls
@ -2419,11 +2419,6 @@ export def initHeap(loadedSize)
fin
end
///////////////////////////////////////////////////////////////////////////////////////////////////
export def getGlobals()
return global
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Return a random entry from an array, given its size in number of elements.
export def randomFromArray(arr, siz)

View File

@ -12,10 +12,6 @@ include "gamelib.plh"
include "globalDefs.plh"
include "playtype.plh"
// This pointer is the root of all heap-tracked (and garbage collected) objects.
// See playtype.plh for definitions of all the datastructures and how they interconnect.
word global
// Exported functions go here. First a predef for each one, then a table with function pointers
// in the same order as the constants are defined in the the header.
predef _intimate_setMode, _intimate_displayStr, _intimate_swipeImg
@ -120,6 +116,5 @@ end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Boilerplate module initialization code
global = getGlobals()
return @funcTbl
done

View File

@ -33,10 +33,6 @@ const TYPE_DROP = $0103
const CHAR_WND_STAT_X = 30
const CHAR_WND_INV_X = 16
// This pointer is the root of all heap-tracked (and garbage collected) objects.
// See playtype.plh for definitions of all the datastructures and how they interconnect.
word global
// Exported functions go here. First a predef for each one, then a table with function pointers
// in the same order as the constants are defined in the the header.
predef _party_doPlayerSheet, _party_benchPlayer, _party_unbenchPlayer
@ -467,6 +463,5 @@ end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Boilerplate module initialization code
global = getGlobals()
return @funcTbl
done