Prev: 24897 Up: Map Next: 24965
24917: Match Verb And Noun
Used by the routine at RunScripts.
Accepts a script line whose verb and noun match the command. 126 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 24917 LD A,(HL) The end marker 127 is not a verb.
24918 CP 127
24920 JR NZ,MatchCommand_Verb
24922 LD HL,0 It returns a zero pointer.
24925 RET Return.
MatchCommand_Verb 24926 LD A,(23446) The high-priority table matches every line.
24929 OR A
24930 JR NZ,MatchCommand_Hit
24932 LD A,126 A verb of 126 matches any command.
24934 CP (HL)
24935 JR Z,MatchCommand_Noun
24937 LD A,(23423) Otherwise the verb must be the one just typed.
24940 CP (HL)
24941 JR Z,MatchCommand_Noun
24943 INC HL A miss skips this line.
24944 JR MatchCommand_Miss
MatchCommand_Noun 24946 INC HL A noun of 126 matches any noun.
24947 LD A,126
24949 CP (HL)
24950 JR Z,MatchCommand_NounOk
24952 LD A,(23424) Otherwise the noun must be the one just typed.
24955 CP (HL)
24956 JR NZ,MatchCommand_Miss
MatchCommand_NounOk 24958 INC HL The noun matched, so the line's tests follow.
MatchCommand_Hit 24959 PUSH HL Remember this line.
24960 POP DE
24961 RET Return.
MatchCommand_Miss 24962 INC HL Try the next line.
24963 JR SkipLine_Conditions
Prev: 24897 Up: Map Next: 24965