Prev: B714 Up: Map Next: B776
B753: Handler: Match Verb
Used by the routine at GameLoop.
Turn the first word token into a verb and run its action.
Set up to search the verb word tokens table for the first word token.
HandlerMatchVerb B753 LD HL,($AEEA) Set a pointer to the verb-token pointer in HL.
B756 LD BC,($AEF4) Load the verb-token count tokens into BC for the search.
B75A LD A,($AF2E) Get the the first word token from the user input.
B75D CPIR Search the verb word tokens table for a matching token.
B75F JR Z,VerbMatched Jump to VerbMatched if a match was found (Z flag is set).
The token doesn't match any verb.
B761 LD HL,$AF59 Print "I don't understand." and start a new line.
B764 CALL PrintStringAndANewline
B767 RET Return.
A verb was matched! Calculate its index in the table and jump to its handler routine.
VerbMatched B768 LD A,($AEF4) Calculate the verb index: A=the verb-token count-C (total tokens minus remaining tokens after match).
B76B SUB C
B76C DEC A Adjust the index (decrease by one, as indices are zero-based).
B76D LD E,A Store the verb index in E for the table lookup.
B76E LD IX,($AEE4) Set a pointer to the verb-jump pointer in IX.
B772 CALL GetTableEntry Call GetTableEntry to get the address of the verb handler routine for this index.
B775 JP (HL) Jump to the verb handler routine to execute the command.
Prev: B714 Up: Map Next: B776