Prev: C173 Up: Map Next: C1A6
C181: Match Word
Used by the routine at LookupWord.
Compares the four characters with every vocabulary entry.
Input
HL Line pointer
Output
A Token id, or FF if the word is unknown
HL Restored line pointer
MatchWord C181 LD ($5B8C),HL Remember the line pointer in *InputPointer.
C184 LD HL,$A71F The vocabulary starts at Vocabulary, one byte after VocabularyLead.
MatchWord_Next C187 INC HL Compare the next entry with WordToken.
C188 LD DE,$5B7B
C18B LD BC,$0400
MatchWord_Character C18E LD A,(DE) Compare four letters and count the matches.
C18F CP (HL)
C190 JR NZ,MatchWord_Miss
C192 INC C
MatchWord_Miss C193 INC HL
C194 INC DE
C195 DJNZ MatchWord_Character
C197 LD A,(HL) Jump to MatchWord_Done if the table has ended (FF).
C198 CP $FF
C19A JR Z,MatchWord_Done
C19C LD A,$04 Jump back to MatchWord_Next unless all four letters matched.
C19E CP C
C19F JR NZ,MatchWord_Next
C1A1 LD A,(HL) The token byte is the id.
MatchWord_Done C1A2 LD HL,($5B8C) Restore the line pointer from *InputPointer.
C1A5 RET Return.
Prev: C173 Up: Map Next: C1A6