Prev: 6900 Up: Map Next: 694F
692F: 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 692F LD HL,$6291 Set a pointer to UserInput_FirstToken in HL.
6932 LD B,$0A Set a token count in B of 0A.
6934 LD E,$00 Initialise the noun counter in E to 00.
Parser_FindPhrase_Loop1 6936 LD A,(HL) Fetch a user input token.
6937 CP $FF Jump to Parser_FindPhrase_Step2 if the terminator (FF) has been reached.
6939 JR Z,Parser_FindPhrase_Step2
693B EXX Search *Pointer_NounTokens for this token among *Count_Nouns nouns.
693C LD HL,($62D6)
693F LD BC,($62C8)
6943 CPIR
6945 EXX
6946 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.
6948 INC E Increment the noun counter by one.
Parser_FindPhrase_Step1 6949 INC HL Move to the next token.
694A DJNZ Parser_FindPhrase_Loop1 Decrease the token counter and loop back to Parser_FindPhrase_Loop1 until done.
Parser_FindPhrase_Step2 694C XOR A Transfer the noun count into A and set flags.
694D OR E
694E RET Return.
Prev: 6900 Up: Map Next: 694F