Prev: 26880 Up: Map Next: 26959
26927: Parser: Find Phrase
Count how many tokens in the user input refer to known nouns.
Output
A The number of noun references in the user input tokens
E As A
F The Z flag is set when no nouns are present in the input
Parser_FindPhrase 26927 LD HL,25233 Set a pointer to UserInput_FirstToken in HL.
26930 LD B,10 Set a token count in B of 10.
26932 LD E,0 Initialise the noun counter in E to 0.
Parser_FindPhrase_Loop1 26934 LD A,(HL) Fetch a user input token.
26935 CP 255 Jump to Parser_FindPhrase_Step2 if the terminator (255) has been reached.
26937 JR Z,Parser_FindPhrase_Step2
26939 EXX Search *Pointer_NounTokens for this token among *Count_Nouns nouns.
26940 LD HL,(25302)
26943 LD BC,(25288)
26947 CPIR
26949 EXX
26950 JR NZ,Parser_FindPhrase_Step1 Jump to Parser_FindPhrase_Step1 if this token is not a noun.
This token names a noun, so increase the counter.
26952 INC E Increment the noun counter by one.
Parser_FindPhrase_Step1 26953 INC HL Move to the next token.
26954 DJNZ Parser_FindPhrase_Loop1 Decrease the token counter and loop back to Parser_FindPhrase_Loop1 until done.
Parser_FindPhrase_Step2 26956 XOR A Transfer the noun count into A and set flags.
26957 OR E
26958 RET Return.
Prev: 26880 Up: Map Next: 26959