Sherlock: annotated disassembly

Routines

Prev: D6BF Up: Map Next: D6E5
D6CE: Read one word and classify it as noun or verb
Calls the tokenizer (D9C5) and checks its class-byte result: $D0 means noun (jumps to D6E0 to handle that), $C0 means verb (falls through to accept it); anything else retries by calling the tokenizer again.
Read as: the tokenizer resolves the word immediately, but offers it under a sequence of candidate classes until one matches what the caller is looking for.
Output
A The class byte
F NZ for a verb; Z with HL = $D6E5 for an unknown word
D6CE LD HL,$5B00 Always start reading from the input buffer
D6D1 CALL $D9C5 Ask the tokenizer for the next word
D6D4 CP $D0 Is it a noun?
D6D6 JP Z,$D6E0 If A equals $D0, skip ahead to D6E0
D6D9 CP $C0 ...or a verb?
D6DB JR NZ,$D6D1 Neither: try again
D6DD OR $01 Verb accepted
D6DF RET Return to the caller
D6E0 LD HL,$D6E5
D6E3 XOR A Set A to zero, which sets the zero flag for the caller
D6E4 RET Return to the caller
Prev: D6BF Up: Map Next: D6E5