Prev: 49523 Up: Map Next: 49574
49537: 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 255 if the word is unknown
HL Restored line pointer
MatchWord 49537 LD (23436),HL Remember the line pointer in *InputPointer.
49540 LD HL,42783 The vocabulary starts at Vocabulary, one byte after VocabularyLead.
MatchWord_Next 49543 INC HL Compare the next entry with WordToken.
49544 LD DE,23419
49547 LD BC,1024
MatchWord_Character 49550 LD A,(DE) Compare four letters and count the matches.
49551 CP (HL)
49552 JR NZ,MatchWord_Miss
49554 INC C
MatchWord_Miss 49555 INC HL
49556 INC DE
49557 DJNZ MatchWord_Character
49559 LD A,(HL) Jump to MatchWord_Done if the table has ended (255).
49560 CP 255
49562 JR Z,MatchWord_Done
49564 LD A,4 Jump back to MatchWord_Next unless all four letters matched.
49566 CP C
49567 JR NZ,MatchWord_Next
49569 LD A,(HL) The token byte is the id.
MatchWord_Done 49570 LD HL,(23436) Restore the line pointer from *InputPointer.
49573 RET Return.
Prev: 49523 Up: Map Next: 49574