Prev: DA34 Up: Map Next: DAC6
DA7D: Match The Dictionary Word
Used by the routine at SkipSpaces.
Compares the typed word with this dictionary entry and keeps the match when it is longer than the one already saved.
MatchDictionaryWord DA7D PUSH HL Read the input length.
DA7E PUSH DE
DA7F LD A,($DC13)
DA82 LD B,A
DA83 LD A,($DC14) Jump ahead to MatchDictionaryWord_NoMatch if the first value is at least the second.
DA86 CP B
DA87 JR NC,MatchDictionaryWord_NoMatch
DA89 LD B,$01 Point DE at the word buffer (WordBuffer) and HL at 5C42.
DA8B LD DE,$5C0B
DA8E LD HL,$5C42
MatchDictionaryWord_CompareLetters DA91 LD A,(DE) Jump ahead to MatchDictionaryWord_AcceptLength if this dictionary letter is zero.
DA92 AND A
DA93 JR Z,MatchDictionaryWord_AcceptLength
DA95 CP (HL) Jump ahead to MatchDictionaryWord_AcceptLength if the dictionary letter differs.
DA96 JR NZ,MatchDictionaryWord_AcceptLength
DA98 INC HL Step to the next letter, count one more and jump back to MatchDictionaryWord_CompareLetters.
DA99 INC DE
DA9A INC B
DA9B JR MatchDictionaryWord_CompareLetters
Accepts the saved index while it is still within the match length.
MatchDictionaryWord_AcceptLength DA9D LD A,($DC14) Go to MatchDictionaryWord_RememberLength if the match length equals the saved count.
DAA0 CP B
DAA1 JR Z,MatchDictionaryWord_RememberLength
DAA3 JR C,MatchDictionaryWord_RememberLength Jump ahead to MatchDictionaryWord_RememberLength if the first value is below the second.
MatchDictionaryWord_NoMatch DAA5 POP DE Restore the text pointer from the stack.
DAA6 POP HL
DAA7 XOR A Clear A.
DAA8 RET Return.
Take the input length and remember it in the space marker.
MatchDictionaryWord_RememberLength DAA9 LD A,B Take the dictionary index and store it in the workspace byte at DC14.
DAAA LD ($DC14),A
MatchDictionaryWord_NextEntry DAAD POP HL Go to MatchDictionaryWord_Matched if bit 7 of the next byte is clear.
DAAE PUSH HL
DAAF INC HL
DAB0 BIT 7,(HL)
DAB2 DEC HL
DAB3 JR Z,MatchDictionaryWord_Matched
DAB5 INC HL Step on two places, step to the next entry and take the dictionary index.
DAB6 INC HL
DAB7 LD E,(HL)
DAB8 INC HL
DAB9 LD D,(HL)
DABA LD HL,$5DBF
DABD ADD HL,DE Jump back to MatchDictionaryWord_NextEntry to step to the next entry and step back one entry.
DABE EX (SP),HL
DABF JR MatchDictionaryWord_NextEntry
Keep the match flags before returning.
MatchDictionaryWord_Matched DAC1 POP DE Restore the saved pointers from the stack.
DAC2 POP HL
DAC3 OR %00000001 Reset the zero flag.
DAC5 RET Return.
Prev: DA34 Up: Map Next: DAC6