Prev: 6F27 Up: Map Next: 6FB1
6F3E: Start a dictionary search for the typed word
Copies the letters of the word at HL into the buffer at 7071, keeping only the low five bits of each (so 'a' and 'A' are both 1). Characters below $40 (space, punctuation, ENTER) end the word. The number of letters is stored at 7081.
The first letter (1-26) is then used to index the letter table at 6000, and IX is set to the first dictionary word starting with that letter. Execution continues into 6F69 to unpack it.
Input
HL Start of the typed word
Output
HL End of the typed word
IX Dictionary word
F Z set if the dictionary word starts with the right letter
6F3E LD DE,$7071 Copy letters into the typed-word buffer
6F41 LD B,$00 B = 0
6F43 LD A,(HL) A = (HL)
6F44 CP $40 Is it "@"?
6F46 JR C,$6F50 If A < 64, go to 6F50
6F48 AND $1F Keep only the bits of $1F
6F4A LD (DE),A Store A at (DE)
6F4B INC DE Increment DE
6F4C INC HL Increment HL
6F4D INC B Increment B
6F4E JR $6F43 Continue at 6F43
6F50 LD A,B Save the length
6F51 LD ($7081),A Store A in the typed word length
6F54 PUSH HL Save HL
6F55 LD HL,($7071) Look up the first letter in the letter index
6F58 LD H,$00 H = 0
6F5A LD DE,$6000 DE = Dictionary letter index (6000)
6F5D ADD HL,HL Add HL,HL
6F5E ADD HL,DE Add HL,DE
6F5F LD E,(HL) E = (HL)
6F60 INC HL Increment HL
6F61 LD D,(HL) D = (HL)
6F62 LD IX,$6000 IX = Dictionary letter index (6000)
6F66 ADD IX,DE Add IX,DE
6F68 POP HL Restore HL
This entry point is used by 6E8E to move on to the next dictionary word. It saves IX in $B607 as the current candidate and then unpacks it. Another entry point at 6F6D does the same without updating $B607; the tokeniser uses that one to peek at the following word.
6F69 LD ($B607),IX Store IX in the current dictionary word
Check that the dictionary word at IX starts with the same letter as the typed word. If not, return with Z reset: the search is over.
6F6D LD A,(IX+$00) A = (IX+0)
6F70 AND $1F Keep only the bits of $1F
6F72 LD B,A B = A
6F73 LD A,($7071) A = the contents of 7071
6F76 CP B Compare with B
6F77 RET NZ Return if no
Unpack the dictionary word into 7082. The same end-of-word rule is used everywhere: bit 7 marks the last letter, except in the first two bytes. Letter codes of 0 (padding) are not copied.
6F78 PUSH HL Save HL
6F79 LD HL,$7082 HL = 7082
6F7C LD BC,$0000 BC = 0
6F7F LD A,(IX+$00) A = (IX+0)
6F82 AND $1F Keep only the bits of $1F
6F84 JR Z,$6F89 If it is zero, go to 6F89
6F86 LD (HL),A Store A at (HL)
6F87 INC HL Increment HL
6F88 INC B Increment B
6F89 INC IX Increment IX
6F8B INC C Increment C
6F8C BIT 7,(IX-$01) Test bit 7 of (IX-$01)
6F90 JR Z,$6F7F If the bit is clear, go to 6F7F
6F92 LD A,C A = C
6F93 CP $02 Compare with 2
6F95 JR Z,$6F7F If yes, go to 6F7F
6F97 CP $03 Compare with 3
6F99 JR NZ,$6FA1 If no, go to 6FA1
6F9B BIT 7,(IX-$02) Test bit 7 of (IX-$02)
6F9F JR NZ,$6F7F If the bit is set, go to 6F7F
6FA1 POP HL Restore HL
6FA2 LD A,B A = B
6FA3 LD ($7092),A Store A in the dictionary word length
If this word is a synonym, skip the two bytes that point to the real word, so IX is left pointing at the next word in the dictionary.
6FA6 BIT 6,(IX-$01) Test bit 6 of (IX-$01)
6FAA RET Z Return if the bit is clear
6FAB INC IX Increment IX
6FAD INC IX Increment IX
6FAF XOR A A = 0
6FB0 RET Done
Prev: 6F27 Up: Map Next: 6FB1