Prev: C0EE Up: Map Next: C14C
C104: Keep Token
Used by the routine at LookupWord.
The first word below id 55 is the verb. IT and THEM substitute the previous noun. POLISH, SKIN and BRIDGE are rewritten to internal verbs 2C, 2B and 31. Later words are the noun, then extra words.
Input
A Token id
HL Line pointer
Count this word. A third word is stored as an extra, not as the noun.
KeepToken C104 PUSH AF Stash the id on the stack.
C105 LD A,($5B8B) Increment *WordCount.
C108 INC A
C109 LD ($5B8B),A
C10C CP $03 Jump to StoreExtra if this is a third word.
C10E JR NC,StoreExtra
C110 CP $20 Jump to StoreExtra_Overflow if *WordCount is 20.
C112 JR Z,StoreExtra_Overflow
C114 POP AF Restore the id from the stack.
C115 CP $55 Jump to KeepToken_It if the id is not below 55.
C117 JR NC,KeepToken_It
Store this id as the verb.
KeepToken_Verb C119 LD ($5B7F),A Write the id to *Verb.
C11C JP ParseWord Jump to ParseWord to take the next word.
IT and THEM reuse the previous noun.
KeepToken_It C11F CP $80 Jump to KeepToken_Held if the token is not IT or THEM (80).
C121 JR NZ,KeepToken_Held
C123 LD A,($5B9D) Fetch *PreviousNoun.
A verb already stored means this id is the noun.
KeepToken_Held C126 LD B,A Stash the token in B.
C127 LD A,($5B7F) Test *Verb.
C12A OR A
C12B LD A,B Restore the token from B.
C12C JR NZ,KeepToken_Noun Jump to KeepToken_Noun if a verb is already stored.
POLISH, SKIN and BRIDGE become internal verbs.
KeepToken_Rewrite C12E CP $AF Test for POLISH (AF).
C130 LD A,$2C Jump to KeepToken_Verb with 2C if it matched.
C132 JR Z,KeepToken_Verb
C134 LD A,B Restore the token from B.
C135 CP $F9 Test for SKIN (F9).
C137 LD A,$2B Jump to KeepToken_Verb with 2B if it matched.
C139 JR Z,KeepToken_Verb
C13B LD A,B Restore the token from B.
C13C CP $86 Test for BRIDGE (86).
C13E LD A,$31 Jump to KeepToken_Verb with 31 if it matched.
C140 JR Z,KeepToken_Verb
C142 LD A,B Restore the id when none of those matched.
Store this id as the noun.
KeepToken_Noun C143 LD ($5B80),A Write the id to *Noun and *PreviousNoun.
C146 LD ($5B9D),A
C149 JP ParseWord Jump to ParseWord to take the next word.
Prev: C0EE Up: Map Next: C14C