mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-12-27 10:29:40 +00:00
Moved scenario script strings to aux mem.
This commit is contained in:
parent
cccb136726
commit
57462b7638
@ -1384,26 +1384,29 @@ class PackPartitions
|
|||||||
def fixups = []
|
def fixups = []
|
||||||
|
|
||||||
def nScripts = 0
|
def nScripts = 0
|
||||||
|
def nStringBytes = 0
|
||||||
|
|
||||||
def locationsWithTriggers = [] as Set
|
def locationsWithTriggers = [] as Set
|
||||||
|
|
||||||
def vec_setScriptInfo = 0x300
|
def vec_setScriptInfo = 0x300
|
||||||
def vec_displayStr = 0x303
|
def vec_pushAuxStr = 0x303
|
||||||
def vec_getYN = 0x306
|
def vec_displayStr = 0x306
|
||||||
def vec_setMap = 0x309
|
def vec_getYN = 0x309
|
||||||
def vec_setSky = 0x30C
|
def vec_setMap = 0x30C
|
||||||
def vec_setGround = 0x30F
|
def vec_setSky = 0x30F
|
||||||
def vec_teleport = 0x312
|
def vec_setGround = 0x312
|
||||||
def vec_setPortrait = 0x315
|
def vec_teleport = 0x315
|
||||||
def vec_clrPortrait = 0x318
|
def vec_setPortrait = 0x318
|
||||||
|
def vec_clrPortrait = 0x31B
|
||||||
|
|
||||||
def addString(str)
|
def emitAuxString(str)
|
||||||
{
|
{
|
||||||
|
emitCodeByte(0x54) // CALL
|
||||||
|
emitCodeWord(vec_pushAuxStr)
|
||||||
assert str.size() < 256 : "String too long, max is 255 characters: $str"
|
assert str.size() < 256 : "String too long, max is 255 characters: $str"
|
||||||
def addr = dataAddr()
|
emitCodeByte(str.size())
|
||||||
emitDataByte(str.size())
|
str.each { ch -> emitCodeByte((byte)ch) }
|
||||||
str.each { ch -> emitDataByte((byte)ch) }
|
nStringBytes += str.size() + 1
|
||||||
return addr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1435,6 +1438,8 @@ class PackPartitions
|
|||||||
}
|
}
|
||||||
makeInit(mapName, scripts, xRange, yRange)
|
makeInit(mapName, scripts, xRange, yRange)
|
||||||
emitFixupByte(0xFF)
|
emitFixupByte(0xFF)
|
||||||
|
|
||||||
|
//println " Code stats: data=${data.size}, bytecode=${bytecode.size} (str=$nStringBytes), fixups=${fixups.size}"
|
||||||
//println "data: $data"
|
//println "data: $data"
|
||||||
//println "bytecode: $bytecode"
|
//println "bytecode: $bytecode"
|
||||||
//println "fixups: $fixups"
|
//println "fixups: $fixups"
|
||||||
@ -1603,9 +1608,7 @@ class PackPartitions
|
|||||||
def text = fld.text()
|
def text = fld.text()
|
||||||
//println " text: '$text'"
|
//println " text: '$text'"
|
||||||
|
|
||||||
emitCodeByte(0x26) // LA
|
emitAuxString(text)
|
||||||
def textAddr = addString(text)
|
|
||||||
emitCodeFixup(textAddr)
|
|
||||||
emitCodeByte(0x54) // CALL
|
emitCodeByte(0x54) // CALL
|
||||||
emitCodeWord(vec_displayStr)
|
emitCodeWord(vec_displayStr)
|
||||||
emitCodeByte(0x30) // DROP
|
emitCodeByte(0x30) // DROP
|
||||||
@ -1836,9 +1839,7 @@ class PackPartitions
|
|||||||
shortName = (" " * extra) + shortName
|
shortName = (" " * extra) + shortName
|
||||||
|
|
||||||
// Code to register the table and map name
|
// Code to register the table and map name
|
||||||
emitCodeByte(0x26) // LA
|
emitAuxString(shortName)
|
||||||
def textAddr = addString(shortName)
|
|
||||||
emitCodeFixup(textAddr)
|
|
||||||
emitCodeByte(0x26) // LA
|
emitCodeByte(0x26) // LA
|
||||||
emitCodeFixup(dataAddr())
|
emitCodeFixup(dataAddr())
|
||||||
emitCodeByte(0x54) // CALL
|
emitCodeByte(0x54) // CALL
|
||||||
|
@ -171,6 +171,69 @@ asm render // no params
|
|||||||
+asmPlasm 0
|
+asmPlasm 0
|
||||||
jmp $6018
|
jmp $6018
|
||||||
end
|
end
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
asm pushAuxStr // params: none; ret: $200 (inbuf)
|
||||||
|
stx tmp ; save PLASMA's X reg eval stack index
|
||||||
|
tsx
|
||||||
|
lda $103,x ; get PLASMA's Y-reg value from its place in the stack
|
||||||
|
tay
|
||||||
|
|
||||||
|
; Create the following subroutine, used to copy chars from aux to main:
|
||||||
|
;0010- 8D 03 C0 STA $C003
|
||||||
|
;0013- C8 INY
|
||||||
|
;0014- D0 02 BNE $0018
|
||||||
|
;0016- E6 F5 INC $F5
|
||||||
|
;0018- B1 F4 LDA ($F4),Y
|
||||||
|
;001A- 8D 02 C0 STA $C002
|
||||||
|
;001D- 60 RTS
|
||||||
|
lda #$8D
|
||||||
|
sta $10
|
||||||
|
sta $1A
|
||||||
|
ldx #2
|
||||||
|
stx $15
|
||||||
|
stx $1B
|
||||||
|
inx
|
||||||
|
stx $11
|
||||||
|
lda #$C0
|
||||||
|
sta $12
|
||||||
|
sta $1C
|
||||||
|
lda #$C8
|
||||||
|
sta $13
|
||||||
|
lda #$D0
|
||||||
|
sta $14
|
||||||
|
lda #$E6
|
||||||
|
sta $16
|
||||||
|
ldx #$F5
|
||||||
|
stx $17
|
||||||
|
lda #$B1
|
||||||
|
sta $18
|
||||||
|
dex
|
||||||
|
stx $19
|
||||||
|
lda #$60
|
||||||
|
sta $1D
|
||||||
|
|
||||||
|
; Get string length and save it
|
||||||
|
jsr $10
|
||||||
|
sta $200
|
||||||
|
ldx #0
|
||||||
|
; Copy entire string
|
||||||
|
- cpx $200
|
||||||
|
beq +
|
||||||
|
jsr $10
|
||||||
|
inx
|
||||||
|
sta $200,x
|
||||||
|
bne -
|
||||||
|
+ tsx
|
||||||
|
tya
|
||||||
|
sta $103,x ; modify PLASMA's Y reg so it picks up code execution just after the string
|
||||||
|
ldx tmp ; retrieve PLASMA's eval stack ptr
|
||||||
|
dex ; make room for ret value
|
||||||
|
lda #0
|
||||||
|
sta evalStkL,x ; return value lo (<$200)
|
||||||
|
lda #2
|
||||||
|
sta evalStkH,x ; and hi (>$200)
|
||||||
|
rts
|
||||||
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
asm blitPortrait // params: srcData, dstScreenPtr
|
asm blitPortrait // params: srcData, dstScreenPtr
|
||||||
@ -1204,35 +1267,39 @@ def setCallbacks()
|
|||||||
|
|
||||||
// $303
|
// $303
|
||||||
callbacks.3 = $4c
|
callbacks.3 = $4c
|
||||||
callbacks:4 = @scriptDisplayStr
|
callbacks:4 = @pushAuxStr
|
||||||
|
|
||||||
// $306
|
// $306
|
||||||
callbacks.6 = $4c
|
callbacks.6 = $4c
|
||||||
callbacks:7 = @getYN
|
callbacks:7 = @scriptDisplayStr
|
||||||
|
|
||||||
// $309
|
// $309
|
||||||
callbacks.9 = $4c
|
callbacks.9 = $4c
|
||||||
callbacks:10 = @queue_setMap
|
callbacks:10 = @getYN
|
||||||
|
|
||||||
// $30C
|
// $30C
|
||||||
callbacks.12 = $4c
|
callbacks.12 = $4c
|
||||||
callbacks:13 = @setSky
|
callbacks:13 = @queue_setMap
|
||||||
|
|
||||||
// $30F
|
// $30F
|
||||||
callbacks.15 = $4c
|
callbacks.15 = $4c
|
||||||
callbacks:16 = @setGround
|
callbacks:16 = @setSky
|
||||||
|
|
||||||
// $312
|
// $312
|
||||||
callbacks.18 = $4c
|
callbacks.18 = $4c
|
||||||
callbacks:19 = @queue_teleport
|
callbacks:19 = @setGround
|
||||||
|
|
||||||
// $315
|
// $315
|
||||||
callbacks.21 = $4c
|
callbacks.21 = $4c
|
||||||
callbacks:22 = @setPortrait
|
callbacks:22 = @queue_teleport
|
||||||
|
|
||||||
// $318
|
// $318
|
||||||
callbacks.24 = $4c
|
callbacks.24 = $4c
|
||||||
callbacks:25 = @clrPortrait
|
callbacks:25 = @setPortrait
|
||||||
|
|
||||||
|
// $31B
|
||||||
|
callbacks.27 = $4c
|
||||||
|
callbacks:28 = @clrPortrait
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user