Moved expander down into aux 00.790

This commit is contained in:
Martin Haye 2018-04-26 09:19:33 -07:00
parent 7267bb2e91
commit 8ab58e2ad1
7 changed files with 30 additions and 30 deletions

View File

@ -209,7 +209,7 @@ init: !zone
; We'll set up 8 initial segments:
; 0: main $0000 -> 4, active + locked
; 1: aux $0000 -> 2, active + locked
; 2: aux $0800 -> 3, inactive ; TEMPORARY: until we figure out prob w aux screen holes
; 2: aux $0800 -> 3, inactive ; app can use $200.600, but ProRWTS can't r/w it
; 3: aux $BFFD -> 0, active + locked
; 4: main $1000 -> 5, inactive
; 5: main $2000 -> 6, active + locked
@ -243,7 +243,7 @@ init: !zone
inx
stx tSegLink+8
; Then the addresses
lda #8 ; Temporarily avoid aux screen holes; normally this would be 2.
lda #8
sta tSegAdrHi+2
dey
sty tSegAdrHi+3

View File

@ -72,10 +72,9 @@
; AUX 64K MEMORY
; ::::::::::::::
; 0000.01FF 6502 zero page and stack (aux)
; 0200.03FF (currently unused)
; 0400.07FF (unused, but screen holes overwritten by hard drive C7xx ROM)
; 0800.0D82 texture expander part 1 (used by 3D renderer)
; 0D83.9xxx (free, managed)
; 0200.07FF texture expander part 1, and blank texture space (used by 3D renderer)
; 0800.08xx resource map
; 08xx.9xxx (free, managed)
; A0xx.BFFF gameloop PLASMA code (loaded as high as possible)
; C000.CFFF I/O
; (bank 1) D000.DAFF ProRWTS runtime and buffers

View File

@ -35,7 +35,8 @@ const fontEngineLen = $F00 // really a bit less, but this leaves space for de
const fontData = $FB00 // main mem LC
const fontDataLen = $4FA // really only $474, but we need to fill all gaps
const expandVec = $800 // aux mem (only for raycaster)
const expandVec = $200 // aux mem (only for raycaster)
const expandMax = $3600 // max size of unsplit expander
// 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.
@ -73,7 +74,7 @@ tmp = $2
pTmp = $4
; Yes, needs to be adjusted 3 places.
expandVec = $800
expandVec = $200
end
@ -85,7 +86,7 @@ asm setFont(pFont)#0
end
///////////////////////////////////////////////////////////////////////////////////////////////////
asm splitExpander()#1 // param: expandVec; returns: remaining lo-aux size
asm splitExpander()#1 // returns: remaining lo-aux size
!zone {
+asmPlasmRet 0
.jsr
@ -237,7 +238,7 @@ end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Load and display the title screen, set up everything in memory
def _startup()#1
word pEngine, pFont, pMarks, expanderSize
word pEngine, pFont, pMarks, pExpand, expanderSize
puts("Loading game.\n")
@ -277,9 +278,8 @@ def _startup()#1
^$C05F // disable double-hi-res
^EMUSIG_FULL_COLOR
// While we're loading, let's get the expander into aux RAM.
auxMmgr(SET_MEM_TARGET, expandVec)
auxMmgr(QUEUE_LOAD, CODE_EXPAND<<8 | RES_TYPE_CODE)
// While we're loading, let's get the expander into main RAM (we'll copy to aux later)
pExpand = mmgr(QUEUE_LOAD, CODE_EXPAND<<8 | RES_TYPE_CODE)
// Also the automap marking queue/flush code.
pMarks = mmgr(QUEUE_LOAD, CODE_MARKS<<8 | RES_TYPE_CODE)
@ -293,18 +293,16 @@ def _startup()#1
mmgr(FREE_MEMORY, pFont)
mmgr(FREE_MEMORY, pMarks)
// Split the expander (relocating most of it to aux LC ram)
// Move the expander to aux low mem (which can't be r/w by ProRWTS), then split it
// (relocating most of it to aux LC ram)
memcpy(pExpand, expandVec, expandMax, 1) // 1=target qux
expanderSize = splitExpander()
// Lock in the part of the expander that remains in low aux mem.
auxMmgr(FREE_MEMORY, expandVec)
auxMmgr(SET_MEM_TARGET, expandVec)
auxMmgr(REQUEST_MEMORY, expanderSize)
auxMmgr(LOCK_MEMORY, expandVec)
// Done with the main mem copy of the expander
mmgr(FREE_MEMORY, pExpand)
// To reduce fragmentation, load the resource index directly after the
// remaining part of the expander
pResourceIndex = expandVec + expanderSize
// To reduce fragmentation, load the resource index in the lowest possible aux mem spot.
pResourceIndex = $800
auxMmgr(SET_MEM_TARGET, pResourceIndex)
auxMmgr(QUEUE_LOAD, CODE_RESOURCE_INDEX<<8 | RES_TYPE_CODE)
auxMmgr(LOCK_MEMORY, pResourceIndex)

View File

@ -97,6 +97,7 @@ import gamelib
predef rawDisplayf3(fmt, arg1, arg2, arg3)#0
predef rawDisplayStr(str)#0
predef rdkey()#1
predef readAuxByte(ptr)#1
predef removeFromList(pList, toRemove)#0
predef removeNamed(name, pList)#1
predef removePlayerFromParty(playerName)#0

View File

@ -486,7 +486,7 @@ asm _drawLine(color, len, xbyte, xbit, xinc, xdir, y, yinc, ydir)#0
end
///////////////////////////////////////////////////////////////////////////////////////////////////
asm readAuxByte(ptr)#1
export asm readAuxByte(ptr)#1
+asmPlasmRet 1
sta pTmp
sty pTmp+1
@ -2204,6 +2204,8 @@ def initMap(x, y, dir)#0
// If we have a renderer loaded, let it know to flush automap marks
unloadTextures()
printf1("\n\nin initMap: $%x\n", readAuxByte($200)) // FOO
// Reset memory (our module will stay since memory manager locked it upon load)
mmgr(RESET_MEMORY, 0)
renderLoaded = FALSE // leave it this way until all scripts done, else scriptDisplayStr renders
@ -3648,8 +3650,8 @@ def startGame(firstTime, ask)#0
// Create a new game or load an existing one
mmgr(START_LOAD, 1) // code is in partition 1
if firstTime
auxMmgr(SET_MEM_TARGET, $800) // well above where expander loads at startup
auxMmgr(REQUEST_MEMORY, $6000) // plenty of room for expander
auxMmgr(SET_MEM_TARGET, $800) // well above where resource index loads at startup
auxMmgr(REQUEST_MEMORY, $6000) // plenty of room for resource index + temp expander
fin
p_module = mmgr(QUEUE_LOAD, MOD_DISKOPS<<8 | RES_TYPE_MODULE)
mmgr(FINISH_LOAD, 0)

View File

@ -16,7 +16,6 @@
TOP_LINE = $2180 ; 24 lines down from top
NLINES = 128
TEX_SIZE = $555 ; 32x32 + 16x16 + 8x8 + 4x4 + 2x2 + 1x1
PLASMA_FRAME_SIZE = $200
; Byte offset for each pixel in the blit unroll
BLIT_OFF0 = 5
@ -97,7 +96,8 @@ wSpriteLeft = $B4
;---------------------------------
; The following are in aux mem...
expandVec = $800
expandVec = $200
blankTexBuf = $7E0 ; length 31
; back to main mem
;---------------------------------

View File

@ -1310,9 +1310,9 @@ drawRay: !zone
tax ; put in X for indexing
bne .lup ; if non-zero, we have more to draw
rts
.blank lda #0
.blank lda #<blankTexBuf
sta pTex
lda #2 ; blank texture space at $200 (aux)
lda #>blankTexBuf ; blank texture space at $100 (aux)
bne .cont ; always taken
.fade ; Fade this column in the distance
ldy pixNum ; get offset into the blit roll for this column
@ -2048,7 +2048,7 @@ renderFrame: !zone
lda #$30
+ sta setAuxWr
ldy #31
- sta $200,y
- sta blankTexBuf,y
dey
bpl -
sta clrAuxWr