Prev: 46868 Up: Map Next: 46966
46931: Handler: Dispatch 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_DispatchVerb 46931 LD HL,(44778) Set a pointer to *Pointer_VerbWordTokens in HL.
46934 LD BC,(44788) Load *Count_VerbTokens tokens into BC for the search.
46938 LD A,(44846) Get the *UserInput_FirstToken from the user input.
46941 CPIR Search the verb word tokens table for a matching token.
46943 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.".
46945 LD HL,44889 HL=Messaging_IDontUnderstand.
46948 CALL PrintStringAndNewline Call PrintStringAndNewline.
46951 RET Return.
A verb was matched! Calculate its index in the table and jump to its handler routine.
VerbMatched 46952 LD A,(44788) Calculate the verb index: A=*Count_VerbTokens-C (total tokens minus remaining tokens after match).
46955 SUB C
46956 DEC A Adjust the index (decrease by one, as indices are zero-based).
46957 LD E,A Store the verb index in E for the table lookup.
46958 LD IX,(44772) Set a pointer to *Pointer_JumpTable_Verbs in IX.
46962 CALL GetTableEntry Call GetTableEntry to get the address of the verb handler routine for this index.
46965 JP (HL) Jump to the verb handler routine to execute the command.
Prev: 46868 Up: Map Next: 46966