Prev: ED7E Up: Map Next: EDAF
ED8A: Compare Token To Vocabulary Word
Compare the token at DE to the table word at HL. Counts token characters until space, quote or control, requires at least *ParserState_MatchLength characters, then matches that many bytes. Returns with carry reset on a match, set on a miss.
CompareTokenToWord ED8A LD B,$00 Clear the length counter and stash the token pointer.
ED8C PUSH DE
CompareTokenToWord_Count ED8D LD A,(DE) Jump to CompareTokenToWord_CheckLength if *DE is a control character (< 21).
ED8E CP $21
ED90 JR C,CompareTokenToWord_CheckLength
ED92 CP $22 Jump to CompareTokenToWord_CheckLength if *DE is a quote.
ED94 JR Z,CompareTokenToWord_CheckLength
ED96 INC B Count this character and keep scanning the token.
ED97 INC DE
ED98 JR CompareTokenToWord_Count
CompareTokenToWord_CheckLength ED9A POP DE Restore the token pointer; jump to CompareTokenToWord_Miss if it is too short.
ED9B LD A,($5BA4)
ED9E LD C,A
ED9F LD A,B
EDA0 CP C
EDA1 JR C,CompareTokenToWord_Miss
CompareTokenToWord_Match EDA3 LD A,(DE) Jump to CompareTokenToWord_Miss if the next characters differ.
EDA4 CP (HL)
EDA5 JR NZ,CompareTokenToWord_Miss
EDA7 INC HL Advance both pointers and keep matching.
EDA8 INC DE
EDA9 DJNZ CompareTokenToWord_Match
EDAB AND A Clear carry on a full match.
EDAC RET Return.
CompareTokenToWord_Miss EDAD SCF Set carry on a miss.
EDAE RET Return.
Prev: ED7E Up: Map Next: EDAF