![]() |
Routines |
| Prev: C173 | Up: Map | Next: C1A6 |
|
Used by the routine at LookupWord.
Compares the four characters with every vocabulary entry.
|
||||||||||||||
| MatchWord | C181 | LD ($5B8C),HL | Remember the line pointer in *InputPointer. | |||||||||||
| C184 | LD HL,$A71F | The vocabulary starts at Vocabulary, one byte after VocabularyLead. | ||||||||||||
|
Compare the next vocabulary entry with WordToken.
|
||||||||||||||
| MatchWord_Next | C187 | INC HL | Step to the next vocabulary entry. | |||||||||||
| C188 | LD DE,$5B7B | Point DE at WordToken. | ||||||||||||
| C18B | LD BC,$0400 | Count four letters, starting from no matches. | ||||||||||||
|
Compare one letter and count it when it matches.
|
||||||||||||||
| MatchWord_Character | C18E | LD A,(DE) | Fetch the token letter. | |||||||||||
| C18F | CP (HL) | Jump to MatchWord_Miss if it does not match. | ||||||||||||
| C190 | JR NZ,MatchWord_Miss | |||||||||||||
| C192 | INC C | Count this match. | ||||||||||||
|
Step on after this letter.
|
||||||||||||||
| MatchWord_Miss | C193 | INC HL | Advance the vocabulary pointer. | |||||||||||
| C194 | INC DE | Advance the token pointer. | ||||||||||||
| C195 | DJNZ MatchWord_Character | Jump back to MatchWord_Character for the next letter. | ||||||||||||
| C197 | LD A,(HL) | Jump to MatchWord_Done if the terminator has been reached (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. | ||||||||||||
|
Restore the line pointer.
|
||||||||||||||
| MatchWord_Done | C1A2 | LD HL,($5B8C) | Restore the line pointer from *InputPointer. | |||||||||||
| C1A5 | RET | Return. | ||||||||||||
| Prev: C173 | Up: Map | Next: C1A6 |