![]() |
Routines |
| Prev: B01F | Up: Map | Next: B081 |
|
Used by the routines at GameLoop and Parser_ShiftSecondTokenToVerb.
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 | B05E | LD HL,($A7E0) | Set a pointer to *Pointer_VerbWordTokens in HL. | |
| B061 | LD BC,($A7EA) | Load *Count_VerbTokens tokens into BC for the search. | ||
| B065 | LD A,($A824) | Get the *UserInput_FirstToken from the user input. | ||
| B068 | CPIR | Search the verb word tokens table for a matching token. | ||
| B06A | 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.".
|
||||
| B06C | LD HL,$A84F | HL=Messaging_IDontUnderstand. | ||
| B06F | CALL PrintStringAndNewline | Call PrintStringAndNewline. | ||
| B072 | RET | Return. | ||
|
A verb was matched! Calculate its index in the table and jump to its handler routine.
|
||||
| VerbMatched | B073 | LD A,($A7EA) | Calculate the verb index: A=*Count_VerbTokens-C (total tokens minus remaining tokens after match). | |
| B076 | SUB C | |||
| B077 | DEC A | Adjust the index (decrease by one, as indices are zero-based). | ||
| B078 | LD E,A | Store the verb index in E for the table lookup. | ||
| B079 | LD IX,($A7DA) | Set a pointer to *Pointer_JumpTable_Verbs in IX. | ||
| B07D | CALL GetTableEntry | Call GetTableEntry to get the address of the verb handler routine for this index. | ||
| B080 | JP (HL) | Jump to the verb handler routine to execute the command. | ||
|
View the equivalent code in;
|
||||
| Prev: B01F | Up: Map | Next: B081 |