Prev: 50464 Up: Map Next: 50553
50518: Handler: Match Verb
Used by the routine at GameLoop.
Matches the first word token from the user's command against the verb word tokens table. If a match is found, it calculates the verb index and jumps to the corresponding verb handler routine. If no match is found, it displays "I Don't Understand" and returns.
Set up to search the verb word tokens table for the first word token.
Handler_MatchVerb 50518 LD HL,(48422) Set a pointer to *Pointer_VerbWordTokens in HL.
50521 LD BC,(48428) Load *Count_VerbTokens tokens into BC for the search.
50525 LD A,(48486) Get the *UserInput_Token_1 from the user input.
50528 CPIR Search the verb word tokens table for a matching token.
50530 JR Z,VerbMatched Jump to VerbMatched if a match was found (Z flag is set).
The token doesn't match any verb. Display an error message: "I don't understand.".
50532 LD HL,48529 HL=Messaging_IDontUnderstand.
50535 CALL PrintStringAndNewline Call PrintStringAndNewline.
50538 RET Return.
A verb was matched! Calculate its index in the table and jump to its handler routine.
VerbMatched 50539 LD A,(48428) Calculate the verb index: A=*Count_VerbTokens-C (total tokens minus remaining tokens after match).
50542 SUB C
50543 DEC A Adjust the index (decrease by one, as indices are zero-based).
50544 LD E,A Store the verb index in E for the table lookup.
50545 LD IX,(48416) Set a pointer to *Pointer_JumpTable_Verbs in IX.
50549 CALL GetTableEntry Call GetTableEntry to get the address of the verb handler routine for this index.
50552 JP (HL) Jump to the verb handler routine to execute the command.
Prev: 50464 Up: Map Next: 50553