Prev: C42F Up: Map Next: C486
C463: 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 C463 LD HL,($BAF6) Set a pointer to *Pointer_VerbWordTokens in HL.
C466 LD BC,($BAFC) Load *Count_VerbTokens tokens into BC for the search.
C46A LD A,($BB36) Get the *UserInput_FirstToken from the user input.
C46D CPIR Search the verb word tokens table for a matching token.
C46F 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.".
C471 LD HL,$BB61 HL=Messaging_IDontUnderstand.
C474 CALL PrintStringAndNewline Call PrintStringAndNewline.
C477 RET Return.
A verb was matched! Calculate its index in the table and jump to its handler routine.
VerbMatched C478 LD A,($BAFC) Calculate the verb index: A=*Count_VerbTokens-C (total tokens minus remaining tokens after match).
C47B SUB C
C47C DEC A Adjust the index (decrease by one, as indices are zero-based).
C47D LD E,A Store the verb index in E for the table lookup.
C47E LD IX,($BAF0) Set a pointer to *Pointer_JumpTable_Verbs in IX.
C482 CALL GetTableEntry Call GetTableEntry to get the address of the verb handler routine for this index.
C485 JP (HL) Jump to the verb handler routine to execute the command.
Prev: C42F Up: Map Next: C486