Prev: ACBD Up: Map Next: AD25
ACFC: Handler: Dispatch Verb
Used by the routine at GameStart.
Matches the first input token from UserInput_FirstToken against the verb tokens at Table_VerbTokens. When a match is found, it indexes the verb script table at JumpTable_VerbScripts and runs that script through Handler_RunScript. When no match is found, it prints the rephrase message and returns.
Search the verb token list at Table_VerbTokens for the first user-input token.
Handler_DispatchVerb ACFC LD HL,$B420 Point HL at the verb tokens table at Table_VerbTokens.
ACFF LD BC,($BBCB) Load the verb-token count from *Count_VerbTokens into BC.
AD03 LD A,($A13B) Fetch the first user-input token from *UserInput_FirstToken into A.
AD06 CPIR Search Table_VerbTokens for a matching token.
AD08 JR Z,VerbMatched Jump to VerbMatched if a match was found.
The token is not a known verb.
Print "Please rephrase that.".
AD0A LD HL,$0018 HL=Messaging_PleaseRephraseThat.
AD0D CALL PrintCompressedStringAndNewline Call PrintCompressedStringAndNewline to print that compressed string and a newline.
AD10 RET Return.
A verb matched: turn its place in Table_VerbTokens into an index for JumpTable_VerbScripts.
VerbMatched AD11 LD A,($BBCB) Fetch the verb-token count from *Count_VerbTokens into A.
AD14 SUB C Subtract the CPIR remainder in C to get the 1-based position.
AD15 DEC A Decrease by one for a zero-based index.
AD16 LD E,A Store that index in E for GetTableEntry.
Look up and run the verb script from JumpTable_VerbScripts.
AD17 LD IX,$B44A Point IX at the verb script table at JumpTable_VerbScripts.
AD1B CALL GetTableEntry Call GetTableEntry to fetch this verb's script address into HL.
AD1E PUSH HL Copy the script address from HL into IX (using the stack).
AD1F POP IX
AD21 CALL Handler_RunScript Call Handler_RunScript to run that script.
AD24 RET Return.
Prev: ACBD Up: Map Next: AD25