Prev: 50223 Up: Map Next: 50310
50275: 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 50275 LD HL,(47862) Set a pointer to *Pointer_VerbWordTokens in HL.
50278 LD BC,(47868) Load *Count_VerbTokens tokens into BC for the search.
50282 LD A,(47926) Get the *UserInput_FirstToken from the user input.
50285 CPIR Search the verb word tokens table for a matching token.
50287 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.".
50289 LD HL,47969 HL=Messaging_IDontUnderstand.
50292 CALL PrintStringAndNewline Call PrintStringAndNewline.
50295 RET Return.
A verb was matched! Calculate its index in the table and jump to its handler routine.
VerbMatched 50296 LD A,(47868) Calculate the verb index: A=*Count_VerbTokens-C (total tokens minus remaining tokens after match).
50299 SUB C
50300 DEC A Adjust the index (decrease by one, as indices are zero-based).
50301 LD E,A Store the verb index in E for the table lookup.
50302 LD IX,(47856) Set a pointer to *Pointer_JumpTable_Verbs in IX.
50306 CALL GetTableEntry Call GetTableEntry to get the address of the verb handler routine for this index.
50309 JP (HL) Jump to the verb handler routine to execute the command.
Prev: 50223 Up: Map Next: 50310