Prev: 46868 Up: Map Next: 46966
46931: 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 46931 LD HL,(44778) Set a pointer to the verb-token pointer in HL.
46934 LD BC,(44788) Load the verb-token count tokens into BC for the search.
46938 LD A,(44846) Get the the first word token 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.
46945 LD HL,44889 Print "I don't understand." and start a new line.
46948 CALL PrintStringAndANewline
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=the verb-token count-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 the verb-jump pointer 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