mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-26 00:29:30 +00:00
Doing some speed testing.
This commit is contained in:
parent
18c9e9528f
commit
7fb830793c
|
@ -1285,8 +1285,9 @@ class A2PackPartitions
|
|||
tileSets.each { k,v -> chunks.add([type:TYPE_TILE_SET, num:v.num, name:k, buf:compress(v.buf)]) }
|
||||
maps3D.each { k,v -> chunks.add([type:TYPE_3D_MAP, num:v.num, name:k, buf:compress(v.buf)]) }
|
||||
textures.each { k,v -> chunks.add([type:TYPE_TEXTURE_IMG, num:v.num, name:k, buf:compress(v.buf)]) }
|
||||
portraits.each { k,v -> chunks.add([type:TYPE_PORTRAIT, num:v.num, name:k, buf:compress(v.buf)]) }
|
||||
}
|
||||
else if (partNum == 3)
|
||||
portraits.each { k,v -> chunks.add([type:TYPE_PORTRAIT, num:v.num, name:k, buf:compress(v.buf)]) }
|
||||
|
||||
// Generate the header chunk. Leave the first 2 bytes for the # of pages in the hdr
|
||||
def hdrBuf = ByteBuffer.allocate(50000)
|
||||
|
@ -1829,6 +1830,9 @@ class A2PackPartitions
|
|||
def part2Path = new File("build/root/game.part.2.bin").path
|
||||
new File(part2Path).withOutputStream { stream -> writePartition(stream, 2) }
|
||||
|
||||
def part3Path = new File("build/root/game.part.3.bin").path
|
||||
new File(part3Path).withOutputStream { stream -> writePartition(stream, 3) }
|
||||
|
||||
// Print stats (unless there's a warning, in which case focus the user on that)
|
||||
if (nWarnings == 0)
|
||||
reportSizes()
|
||||
|
@ -2605,8 +2609,8 @@ end
|
|||
|
||||
def copyOrCreateSave(dstDir)
|
||||
{
|
||||
def prevSave = new File("build/prevGame/game.1.save.\$f1")
|
||||
def newSave = new File("${dstDir}/game.1.save.\$f1")
|
||||
def prevSave = new File("build/prevGame/game.1.save.bin")
|
||||
def newSave = new File("${dstDir}/game.1.save.bin")
|
||||
if (prevSave.exists()) {
|
||||
copyIfNewer(prevSave, newSave)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd /Users/mhaye/plat/ProRWTS && make && \
|
||||
cd /Users/mhaye/plat/PLASMA/src && make vm && \
|
||||
cd /Users/mhaye/plat/PackPartitions && rm -f dist/PackPartitions.jar && ant jar
|
||||
cd /Users/mhaye/plat/tools/ProRWTS && make && \
|
||||
cd /Users/mhaye/plat/tools/PLASMA/src && make vm && \
|
||||
cd /Users/mhaye/plat/tools/PackPartitions && rm -f dist/PackPartitions.jar && ant jar
|
||||
|
|
Binary file not shown.
|
@ -132,6 +132,11 @@ decomp !zone {
|
|||
+ rol
|
||||
bcc - ; always taken except if overflow error, in which case whatevs.
|
||||
|
||||
.chk ora pDst
|
||||
eor pEnd
|
||||
beq .ret
|
||||
brk
|
||||
|
||||
; Get another 8 bits into our bit buffer. Destroys X. Preserves A. Requires Y=0.
|
||||
.getbts tax
|
||||
lda (pSrc),y
|
||||
|
@ -144,11 +149,6 @@ decomp !zone {
|
|||
txa
|
||||
.ret rts
|
||||
|
||||
.chk ora pDst
|
||||
eor pEnd
|
||||
beq .ret
|
||||
brk
|
||||
|
||||
!if DEBUG {
|
||||
.dbg1 pha
|
||||
lda #'L'|$80
|
||||
|
|
|
@ -15,6 +15,16 @@ include "diskops.plh"
|
|||
include "gen_modules.plh"
|
||||
include "gen_players.plh"
|
||||
|
||||
const RWTS_SEEK = 0
|
||||
const RWTS_READ = 1
|
||||
const RWTS_WRITE = 2
|
||||
|
||||
const RWTS_DRV1 = 0
|
||||
const RWTS_DRV2 = $80
|
||||
|
||||
const RWTS_RDWRPART = (0<<8)
|
||||
const RWTS_OPENDIR = (1<<8)
|
||||
|
||||
// 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
|
||||
|
@ -45,10 +55,90 @@ DEBUG = 0
|
|||
tmp = $2
|
||||
pTmp = $4
|
||||
|
||||
; ProRWTS equates
|
||||
proRWTS = $D000 ;over in aux LC (in bank 1 just like mem mgr)
|
||||
|
||||
status = $3 ;returns non-zero on error
|
||||
auxreq = $a ;set to 1 to read/write aux memory, else main memory is used
|
||||
sizelo = $6 ;set if enable_write=1 and writing, or reading, or if enable_seek=1 and seeking
|
||||
sizehi = $7 ;set if enable_write=1 and writing, or reading, or if enable_seek=1 and seeking
|
||||
reqcmd = $2 ;set (read/write/seek) if enable_write=1 or enable_seek=1
|
||||
;if allow_multi=1, bit 7 selects floppy drive in current slot
|
||||
; (clear=drive 1, set=drive 2) during open call
|
||||
;bit 7 must be clear for read/write/seek on opened file
|
||||
ldrlo = $E ;set to load address if override_adr=1
|
||||
ldrhi = $F ;set to load address if override_adr=1
|
||||
namlo = $C ;name of file to access
|
||||
namhi = $D ;name of file to access
|
||||
|
||||
cmdseek = 0 ;requires enable_seek=1
|
||||
cmdread = 1 ;requires enable_write=1
|
||||
cmdwrite = 2 ;requires enable_write=1
|
||||
|
||||
end
|
||||
|
||||
def copyHeap(dir)
|
||||
fatal("TODO: reimpl with copyMem")
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Params: cmd | open<<8, filename, addr, size. Returns: status (for open only)
|
||||
// cmd:
|
||||
asm callProRWTS
|
||||
+asmPlasm 1
|
||||
; Params come to us from PLASMA in reverse order
|
||||
sta setAuxZP
|
||||
sta sizelo
|
||||
sty sizehi
|
||||
|
||||
sta clrAuxZP
|
||||
lda evalStkL+1,x
|
||||
ldy evalStkH+1,x
|
||||
sta setAuxZP
|
||||
sta ldrlo
|
||||
sty ldrhi
|
||||
|
||||
sta clrAuxZP
|
||||
lda evalStkL+2,x
|
||||
ldy evalStkH+2,x
|
||||
sta setAuxZP
|
||||
sta namlo
|
||||
sty namhi
|
||||
|
||||
sta clrAuxZP
|
||||
lda evalStkL+3,x
|
||||
ldy evalStkH+3,x
|
||||
sta setAuxZP
|
||||
sta reqcmd
|
||||
|
||||
lda #$60
|
||||
sta 0
|
||||
jsr 0
|
||||
|
||||
bit setLcRW+lcBank1
|
||||
bit setLcRW+lcBank1
|
||||
tya
|
||||
bne +
|
||||
jsr proRWTS
|
||||
clc
|
||||
bcc ++
|
||||
+ jsr proRWTS+3
|
||||
++ lda status
|
||||
ldy #0
|
||||
bit setLcRW+lcBank2
|
||||
bit setLcRW+lcBank2
|
||||
sta clrAuxZP
|
||||
rts
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def _rwGame(cmd)
|
||||
while TRUE
|
||||
if callProRWTS(cmd | RWTS_OPENDIR, "GAME.1.SAVE", $5000, HEAP_SIZE) == 0
|
||||
break
|
||||
fin
|
||||
textHome()
|
||||
^$c051
|
||||
puts("Insert disk 1")
|
||||
rdkey()
|
||||
^$c050
|
||||
loop
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -57,60 +147,24 @@ 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
|
||||
|
||||
// Copy data to main memory
|
||||
// Copy data to main memory, and write it out.
|
||||
showMapName("Saving game...")
|
||||
copyHeap(0) // LC to low mem
|
||||
|
||||
// Open the file if it already exists...
|
||||
//open_filename = @game1_filename
|
||||
//open_buffer = $5C00
|
||||
//if callMLI(MLI_OPEN, @open_params) > 0
|
||||
//create_filename = open_filename
|
||||
//create_accessbits = $C3 // full access
|
||||
//create_filetype = $F1 // user type 1
|
||||
//create_auxtype = 0
|
||||
//create_storagetype = 1
|
||||
//create_date = 0
|
||||
//create_time = 0
|
||||
//guaranteeMLI(MLI_CREATE, @create_params)
|
||||
//guaranteeMLI(MLI_OPEN, @open_params)
|
||||
//fin
|
||||
|
||||
// Write the game data to it
|
||||
//write_fileref = open_fileref
|
||||
//write_addr = $5000
|
||||
//write_length = HEAP_SIZE
|
||||
//guaranteeMLI(MLI_WRITE, @write_params)
|
||||
|
||||
// All done.
|
||||
//close_fileref = open_fileref
|
||||
//guaranteeMLI(MLI_CLOSE, @close_params)
|
||||
memcpy(HEAP_BOTTOM, $5000, HEAP_SIZE) // LC to low mem
|
||||
_rwGame(RWTS_WRITE)
|
||||
end
|
||||
|
||||
def loadInternal()
|
||||
word p_loaded
|
||||
|
||||
// Open the file. If that fails, return FALSE (instead of halting)
|
||||
//open_filename = @game1_filename
|
||||
//open_buffer = $5C00
|
||||
//if callMLI(MLI_OPEN, @open_params) > 0; return FALSE; fin
|
||||
|
||||
// Read the game data from it
|
||||
//read_fileref = open_fileref
|
||||
//read_addr = $5000
|
||||
//read_length = HEAP_SIZE
|
||||
//guaranteeMLI(MLI_READ, @read_params)
|
||||
|
||||
// All done with the file
|
||||
//close_fileref = open_fileref
|
||||
//guaranteeMLI(MLI_CLOSE, @close_params)
|
||||
// Load data to main memory
|
||||
_rwGame(RWTS_READ)
|
||||
|
||||
// Copy the heap up, and init it with the correct size.
|
||||
p_loaded = $5000
|
||||
if p_loaded=>w_heapSize < 100 or p_loaded=>w_heapSize > HEAP_SIZE
|
||||
fatal("Corrupt game file.")
|
||||
fin
|
||||
copyHeap(1) // low mem to LC
|
||||
memcpy($5000, HEAP_BOTTOM, HEAP_SIZE) // low mem to LC
|
||||
initHeap(p_loaded=>w_heapSize)
|
||||
global = getGlobals()
|
||||
return TRUE
|
||||
|
|
|
@ -29,7 +29,7 @@ import gamelib
|
|||
predef setGameFlag, getGameFlag, scriptSetAvatar, parseDecWithDefault, readStr
|
||||
predef addPlayerToParty, removePlayerFromParty, partyHasPlayer, loadFrameImg, loadMainFrameImg
|
||||
predef scriptSwapTile, setIntimateMode, fontCmd, setIntimateMode
|
||||
predef callGlobalFunc, getCharResponse
|
||||
predef callGlobalFunc, getCharResponse, memcpy
|
||||
|
||||
/////////// Shared string constants //////////////
|
||||
|
||||
|
|
|
@ -157,6 +157,71 @@ magic = $2227 ; there are 2048 magic values that work; this one caught my
|
|||
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
asm readNoSlotClock // param: dstBuf (will receive 8 BCD bytes)
|
||||
!zone {
|
||||
+asmPlasm 1
|
||||
; record dst ptr
|
||||
sta tmp
|
||||
sty tmp+1
|
||||
; obtain a pointer to our little table of magic values
|
||||
lda #$60
|
||||
sta pTmp
|
||||
.base = *+2
|
||||
jsr pTmp
|
||||
tsx
|
||||
dex
|
||||
dex
|
||||
txs
|
||||
pla
|
||||
sta pTmp
|
||||
pla
|
||||
sta pTmp+1
|
||||
ldy #<(.tbl - .base)
|
||||
; record state of slot ROM, then turn on C3 ROM
|
||||
sei
|
||||
lda $CFFF
|
||||
pha
|
||||
sta $C300
|
||||
lda $C304
|
||||
ldx #8
|
||||
.wr1:
|
||||
lda (pTmp),y
|
||||
sec
|
||||
ror
|
||||
.wr2:
|
||||
bcs +
|
||||
bit $C300
|
||||
bcc ++
|
||||
+ bit $C301
|
||||
++ lsr
|
||||
bne .wr2
|
||||
iny
|
||||
dex
|
||||
bne .wr1
|
||||
ldy #7
|
||||
.rd1:
|
||||
ldx #8
|
||||
.rd2:
|
||||
lda $C304
|
||||
lsr
|
||||
ror pTmp
|
||||
dex
|
||||
bne .rd2
|
||||
lda pTmp
|
||||
sta (tmp),y
|
||||
dey
|
||||
bpl .rd1
|
||||
; restore slot ROM state
|
||||
pla
|
||||
bmi +
|
||||
sta $CFFF
|
||||
+ cli
|
||||
rts
|
||||
.tbl !byte $C5,$3A,$A3,$5C,$C5,$3A,$A3,$5C
|
||||
} ; end zone
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Temporary hack: after scriptDisplayStr is called, generated code calls this to clear the PLASMA
|
||||
// string pool. That way, many long strings can be used in a single function.
|
||||
|
@ -965,7 +1030,7 @@ export def setPlural(flg)
|
|||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Convert signed decimal to string in decimalBuf
|
||||
// Convert signed decimal to string in decimalBuf (@decimalBuf returned)
|
||||
def convertDec(n)
|
||||
word n0
|
||||
word p
|
||||
|
@ -1691,15 +1756,15 @@ end
|
|||
// Get a key and dispatch it to a command. Then do it again, forever.
|
||||
def kbdLoop()
|
||||
word key, func
|
||||
word errMsg
|
||||
byte xreg, tmp
|
||||
errMsg = "Error: x reg changed from %x to %x\n"
|
||||
xreg = getXReg()
|
||||
while TRUE
|
||||
// If the asm routines all work correctly, by the time we get to the top of this loop
|
||||
// the X register should always have the same value.
|
||||
tmp = getXReg()
|
||||
if tmp <> xreg
|
||||
printf2(errMsg, xreg, tmp)
|
||||
brk()
|
||||
printHex(xreg<<8 | tmp)
|
||||
fatal("xRegChg")
|
||||
fin
|
||||
key = getUpperKey()
|
||||
if key >= 0 and key < $60
|
||||
|
@ -2685,11 +2750,44 @@ def startGame(ask)
|
|||
crout()
|
||||
end
|
||||
|
||||
def getTick()
|
||||
byte timeBuf[8]
|
||||
word tick
|
||||
readNoSlotClock(@timeBuf)
|
||||
tick = (timeBuf[7] & $F) + ((timeBuf[7] >> 4) * 10)
|
||||
tick = tick + ((timeBuf[6] & $F) * 100) + ((timeBuf[6] >> 4) * 1000)
|
||||
return tick + (((timeBuf[5] & $F) % 5) * 6000)
|
||||
end
|
||||
|
||||
def tickDiff(tStart, tEnd)
|
||||
word diff
|
||||
diff = tEnd - tStart
|
||||
if diff >= 0; return diff; fin
|
||||
return diff + 30000
|
||||
end
|
||||
|
||||
def speedTest()
|
||||
word start, diff
|
||||
while TRUE
|
||||
start = getTick()
|
||||
mapNum = 5
|
||||
mapIs3D = 1
|
||||
initMap(7, 13, 12)
|
||||
mapNum = 1
|
||||
mapIs3D = 0
|
||||
initMap(7, 120, 0)
|
||||
diff = tickDiff(start, getTick())
|
||||
^$c051
|
||||
printf1("diff=%d\n", diff)
|
||||
loop
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Main code.
|
||||
//
|
||||
loadTitle()
|
||||
startGame(TRUE) // ask whether new or load
|
||||
speedTest()
|
||||
kbdLoop()
|
||||
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue
Block a user