Prev: 6141 Up: Map Next: 6185
6155: Match Verb And Noun
Used by the routine at RunScripts.
Accepts a script line whose verb and noun match the command. 7E matches any word. The high-priority table matches every line.
Output
HL Zero at the end of the table, otherwise the first condition or action.
MatchCommand 6155 LD A,(HL) The end marker 7F is not a verb.
6156 CP $7F
6158 JR NZ,MatchCommand_Verb
615A LD HL,$0000 It returns a zero pointer.
615D RET Return.
MatchCommand_Verb 615E LD A,($5B96) The high-priority table matches every line.
6161 OR A
6162 JR NZ,MatchCommand_Hit
6164 LD A,$7E A verb of 7E matches any command.
6166 CP (HL)
6167 JR Z,MatchCommand_Noun
6169 LD A,($5B7F) Otherwise the verb must be the one just typed.
616C CP (HL)
616D JR Z,MatchCommand_Noun
616F INC HL A miss skips this line.
6170 JR MatchCommand_Miss
MatchCommand_Noun 6172 INC HL A noun of 7E matches any noun.
6173 LD A,$7E
6175 CP (HL)
6176 JR Z,MatchCommand_NounOk
6178 LD A,($5B80) Otherwise the noun must be the one just typed.
617B CP (HL)
617C JR NZ,MatchCommand_Miss
MatchCommand_NounOk 617E INC HL The noun matched, so the line's tests follow.
MatchCommand_Hit 617F PUSH HL Remember this line.
6180 POP DE
6181 RET Return.
MatchCommand_Miss 6182 INC HL Try the next line.
6183 JR SkipLine_Conditions
Prev: 6141 Up: Map Next: 6185