mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-08-06 09:25:06 +00:00
String response gathering and checking now working.
This commit is contained in:
@@ -1864,8 +1864,10 @@ class PackPartitions
|
||||
|
||||
def copyIfNewer(fromFile, toFile)
|
||||
{
|
||||
if (!toFile.exists())
|
||||
if (!toFile.exists() || fromFile.lastModified() > toFile.lastModified()) {
|
||||
toFile.delete()
|
||||
Files.copy(fromFile.toPath(), toFile.toPath())
|
||||
}
|
||||
}
|
||||
|
||||
def createImage()
|
||||
|
@@ -446,6 +446,7 @@ loMemBegin: !pseudopc $800 {
|
||||
jmp j_main_dispatch
|
||||
jmp j_aux_dispatch
|
||||
jmp __asmPlasm
|
||||
jmp __asmPlasm_bank2
|
||||
|
||||
; Vectors for debug macros
|
||||
jmp __writeStr
|
||||
@@ -623,6 +624,7 @@ l_SXXX: !zone {
|
||||
;------------------------------------------------------------------------------
|
||||
; Utility routine for convenient assembly routines in PLASMA code.
|
||||
; Params: Y=number of parameters passed from PLASMA routine
|
||||
; 0. (optional) switch to Language Card bank 2
|
||||
; 1. Save PLASMA's X register index to evalStk
|
||||
; 2. Verify X register is in the range 0-$10
|
||||
; 3. Load the *last* parameter into A=lo, Y=hi
|
||||
@@ -630,6 +632,9 @@ l_SXXX: !zone {
|
||||
; 5. Restore PLASMA's X register, and advance it over the parameter(s)
|
||||
; 6. Store A=lo/Y=hi into PLASMA return value
|
||||
; 7. Return to PLASMA
|
||||
__asmPlasm_bank2:
|
||||
bit setLcRW+lcBank2
|
||||
bit setLcRW+lcBank2
|
||||
__asmPlasm: !zone
|
||||
pla ; save address of calling routine, so we can call it
|
||||
clc
|
||||
|
@@ -102,6 +102,11 @@ SaveCursor JMP SvCurs
|
||||
;Restore the cursor position
|
||||
RestCursor JMP RsCurs
|
||||
|
||||
;To get a string of text up to 40 chars long using a
|
||||
;flashing cursor use GetStr. It allows use of either
|
||||
;left arrow or delete key to backspace.
|
||||
GetStr JMP In_Str
|
||||
|
||||
;If you know which of the {0..110} bitmapped characters
|
||||
;you want plotted, you can bypass testing for control
|
||||
;codes, making this a faster way to plot.
|
||||
@@ -117,11 +122,6 @@ GetYN_Flg !byte $00 ;flag: force Y/N input
|
||||
CursIcn !byte 103 ;cursor icon 103=cactus
|
||||
GetAsc JMP Get_Chr ;API call address
|
||||
|
||||
;To get a string of text up to 40 chars long using a
|
||||
;flashing cursor use GetStr. It allows use of either
|
||||
;left arrow or delete key to backspace.
|
||||
GetStr JMP In_Str
|
||||
|
||||
Font0 !word 0 ;address of font
|
||||
CharRate !byte 0 ;plot rate {0..FF} 0=fastest
|
||||
WaitStat !byte 0 ;Wait State {0,1,2,3,4,5,6,7}
|
||||
|
@@ -22,4 +22,5 @@ DisplayChar = CopyWindow+3
|
||||
DisplayStr = DisplayChar+3
|
||||
CalcWidth = DisplayStr+3
|
||||
SaveCursor = CalcWidth+3
|
||||
RestCursor = SaveCursor+3
|
||||
RestCursor = SaveCursor+3
|
||||
GetStr = RestCursor+3
|
@@ -389,10 +389,15 @@ HEAP_COLLECT = $24
|
||||
ldy #nArgs
|
||||
jsr _asmPlasm
|
||||
}
|
||||
!macro asmPlasm_bank2 nArgs {
|
||||
ldy #nArgs
|
||||
jsr _asmPlasm_bank2
|
||||
}
|
||||
_asmPlasm = auxLoader+3
|
||||
_asmPlasm_bank2 = _asmPlasm+3
|
||||
|
||||
; Debug support routines (defined in core/mem.s)
|
||||
_writeStr = _asmPlasm+3
|
||||
_writeStr = _asmPlasm_bank2+3
|
||||
_prByte = _writeStr+3
|
||||
_prSpace = _prByte+3
|
||||
_prWord = _prSpace+3
|
||||
|
@@ -465,7 +465,7 @@ asm hashString
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Print a string
|
||||
// Print a string to the current character output vector
|
||||
asm _puts
|
||||
+asmPlasm 1
|
||||
sta pTmp
|
||||
@@ -642,9 +642,7 @@ end
|
||||
// Set up the font engine
|
||||
// Params: pFont
|
||||
asm setFont
|
||||
+asmPlasm 1
|
||||
bit setLcRW+lcBank2
|
||||
bit setLcRW+lcBank2
|
||||
+asmPlasm_bank2 1
|
||||
jmp SetFont
|
||||
end
|
||||
|
||||
@@ -652,37 +650,37 @@ end
|
||||
// Use the font engine to clear the current text window.
|
||||
// Parameters: top, bottom, left, right
|
||||
asm setWindow
|
||||
+asmPlasm 4
|
||||
bit setLcRW+lcBank2
|
||||
bit setLcRW+lcBank2
|
||||
+asmPlasm_bank2 4
|
||||
jmp SetWindow
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Save the cursor position (1 save slot)
|
||||
asm saveCursor
|
||||
+asmPlasm 0
|
||||
bit setLcRW+lcBank2
|
||||
bit setLcRW+lcBank2
|
||||
+asmPlasm_bank2 0
|
||||
jmp SaveCursor
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Restore the cursor position (1 save slot)
|
||||
asm restoreCursor
|
||||
+asmPlasm 0
|
||||
bit setLcRW+lcBank2
|
||||
bit setLcRW+lcBank2
|
||||
+asmPlasm_bank2 0
|
||||
jmp RestCursor
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Read a keyboard string up to 40 chars using the Font Engine. Returns a zero-terminated string
|
||||
// in the input buffer at $200, with the length stored in $2FF.
|
||||
asm rawGetStr
|
||||
+asmPlasm_bank2 0
|
||||
jmp GetStr
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Use the font engine to clear the current text window
|
||||
// Params: None
|
||||
asm _clearWindow
|
||||
+asmPlasm 0
|
||||
bit setLcRW+lcBank2
|
||||
bit setLcRW+lcBank2
|
||||
+asmPlasm_bank2 0
|
||||
jmp ClearWindow
|
||||
end
|
||||
|
||||
@@ -690,9 +688,7 @@ end
|
||||
// Use the font engine to copy the current text window to hi-res page 2
|
||||
// Params: None
|
||||
asm copyWindow
|
||||
+asmPlasm 0
|
||||
bit setLcRW+lcBank2
|
||||
bit setLcRW+lcBank2
|
||||
+asmPlasm_bank2 0
|
||||
jmp CopyWindow
|
||||
end
|
||||
|
||||
@@ -700,9 +696,7 @@ end
|
||||
// Display a character using the font engine.
|
||||
// Params: ch
|
||||
asm displayChar
|
||||
+asmPlasm 1
|
||||
bit setLcRW+lcBank2
|
||||
bit setLcRW+lcBank2
|
||||
+asmPlasm_bank2 1
|
||||
jmp DisplayChar
|
||||
end
|
||||
|
||||
@@ -710,9 +704,7 @@ end
|
||||
// Display a string using the font engine.
|
||||
// Params: pStr
|
||||
asm _displayStr
|
||||
+asmPlasm 1
|
||||
bit setLcRW+lcBank2
|
||||
bit setLcRW+lcBank2
|
||||
+asmPlasm_bank2 1
|
||||
jmp DisplayStr
|
||||
end
|
||||
|
||||
@@ -720,9 +712,7 @@ end
|
||||
// Calculate string width using the font engine.
|
||||
// Params: pStr
|
||||
asm calcWidth
|
||||
+asmPlasm 1
|
||||
bit setLcRW+lcBank2
|
||||
bit setLcRW+lcBank2
|
||||
+asmPlasm_bank2 1
|
||||
jmp CalcWidth
|
||||
end
|
||||
|
||||
@@ -730,9 +720,7 @@ end
|
||||
// Display a string using the font engine but not its parser.
|
||||
// Params: pStr
|
||||
asm _rawDisplayStr
|
||||
+asmPlasm 1
|
||||
bit setLcRW+lcBank2
|
||||
bit setLcRW+lcBank2
|
||||
+asmPlasm_bank2 1
|
||||
sta pTmp
|
||||
sty pTmp+1
|
||||
ldy #0
|
||||
@@ -829,6 +817,19 @@ def _min(a, b)
|
||||
fin
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Read a string from the keyboard using the font manager, and intern it to the heap.
|
||||
def _getStringResponse()
|
||||
word p
|
||||
rawGetStr()
|
||||
rawDisplayStr("\n") // so Outlaw user doesn't have to remember to make a newline
|
||||
for p = ($1FF + ^$2FF) downto $200
|
||||
p->1 = (^p & $7F)
|
||||
next
|
||||
^$200 = ^$2FF
|
||||
return mmgr(HEAP_INTERN, $200)
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Setter functions for library use
|
||||
def _setPlural(flg)
|
||||
@@ -931,6 +932,15 @@ def parseDecWithDefault(str, default)
|
||||
return parseDec(str)
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Convert a lower-case character to upper-case (or return unchanged if it's not lower-case)
|
||||
def charToUpper(c)
|
||||
if c >= 'a' and c <= 'z'
|
||||
return c - $20
|
||||
fin
|
||||
return c
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Get a keystroke and convert it to upper case
|
||||
def _getUpperKey()
|
||||
@@ -947,11 +957,7 @@ def _getUpperKey()
|
||||
loop
|
||||
key = ^kbd
|
||||
^kbdStrobe
|
||||
key = key & $7F
|
||||
if key >= $60
|
||||
key = key - $20
|
||||
fin
|
||||
return key
|
||||
return charToUpper(key & $7F)
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1803,14 +1809,20 @@ def _makeEnemy(name, healthDice, image0, image1, attackType, attackText, attackR
|
||||
return p
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def _getStringResponse()
|
||||
fatal("getStringResponse() not yet implemented.")
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def _strcmpi(a, b)
|
||||
fatal("strcmpi() not yet implemented.")
|
||||
word limit, lenDiff, diff
|
||||
lenDiff = ^a - ^b
|
||||
limit = a + min(^a, ^b)
|
||||
while a < limit
|
||||
a++
|
||||
b++
|
||||
diff = charToUpper(^a) - charToUpper(^b)
|
||||
if diff <> 0
|
||||
return diff
|
||||
fin
|
||||
loop
|
||||
return lenDiff
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user