![]() |
Routines |
| Prev: 27853 | Up: Map | Next: 28108 |
|
Reads the player's command or replays a stored one, tokenises the words and hands them to the Inglish matcher.
|
||||
| TurnReadAndTokeniseTheCommand | 27884 | LD A,17 | Write 17 to 46870. | |
| 27886 | LD (46870),A | |||
| 27889 | LD A,(46854) | Read the replay path. | ||
| 27892 | INC A | Count on from the replay path. | ||
| 27893 | JR NZ,TurnReadAndTokeniseTheCommand_SetTheLineReadFlag | If A is not zero then jump to TurnReadAndTokeniseTheCommand_SetTheLineReadFlag. | ||
| 27895 | CALL Turn_ResetToThePlayer | Call Turn_ResetToThePlayer to reset the turn to the player. | ||
| 27898 | LD HL,28658 | Point at the input buffer. | ||
| TurnReadAndTokeniseTheCommand_Loop | 27901 | LD A,(HL) | Read the next byte of the input buffer. | |
|
Echo this character of the stored line.
|
||||
| 27902 | CALL Print_Character_0 | Call Print_Character_0 to print one character. | ||
| 27905 | INC HL | Jump back to TurnReadAndTokeniseTheCommand_Loop if the front of the line is not 13. | ||
| 27906 | CP 13 | |||
| 27908 | JR NZ,TurnReadAndTokeniseTheCommand_Loop | |||
| 27910 | LD HL,28660 | Copies 5 bytes from 28660 to 28665. | ||
| 27913 | LD DE,28665 | |||
| 27916 | LD BC,5 | |||
| 27919 | LDIR | |||
| 27921 | JR TurnReadAndTokeniseTheCommand_ClearTheTokenBuffer | Jump to TurnReadAndTokeniseTheCommand_ClearTheTokenBuffer to clear the token buffer. | ||
| TurnReadAndTokeniseTheCommand_SetTheLineReadFlag | 27923 | LD A,1 | Write 1 to 46853. | |
| 27925 | LD (46853),A | |||
| 27928 | LD A,9 | Write 9 to 46870. | ||
| 27930 | LD (46870),A | |||
| 27933 | CALL ReadTheInputLine | Call ReadTheInputLine to read the input line. | ||
| 27936 | JR Z,TurnReadAndTokeniseTheCommand_PointAtTheTokens | Jump to TurnReadAndTokeniseTheCommand_PointAtTheTokens if ReadTheInputLine returned with the zero flag set. | ||
| TurnReadAndTokeniseTheCommand_ClearTheTokenBuffer | 27938 | LD HL,28828 | Write 0 to 64 bytes, starting from 28828 with Blanker. | |
| 27941 | LD B,64 | |||
| 27943 | CALL Blanker | |||
| 27946 | LD HL,28665 | Point at the input buffer. | ||
| 27949 | LD IY,28828 | Point IY at the token buffer. | ||
| TurnReadAndTokeniseTheCommand_TakeTheNextWord | 27953 | CALL Input_TakeTheNextWord | Call Input_TakeTheNextWord to take the next word. | |
| 27956 | CP 208 | Jump to TurnReadAndTokeniseTheCommand_ShowTheUnknownWord if the byte from Input_TakeTheNextWord is 208. | ||
| 27958 | JR Z,TurnReadAndTokeniseTheCommand_ShowTheUnknownWord | |||
| 27960 | CP 144 | Jump to TurnReadAndTokeniseTheCommand_StoreTheToken if that byte is not 144. | ||
| 27962 | JR NZ,TurnReadAndTokeniseTheCommand_StoreTheToken | |||
| 27964 | LD A,B | Jump to TurnReadAndTokeniseTheCommand_StoreTheToken if the low nibble of B or any bit of C is set. | ||
| 27965 | AND 15 | |||
| 27967 | OR C | |||
| 27968 | JR NZ,TurnReadAndTokeniseTheCommand_StoreTheToken | |||
|
Test the conjunction count.
|
||||
| 27970 | LD A,(46875) | Jump to TurnReadAndTokeniseTheCommand_CountConjunctions if *46875 is not zero. | ||
| 27973 | AND A | |||
| 27974 | JR NZ,TurnReadAndTokeniseTheCommand_CountConjunctions | |||
| 27976 | INC A | Count on from the conjunction count. | ||
| 27977 | LD (46875),A | Update *46875. | ||
| 27980 | JR TurnReadAndTokeniseTheCommand_StoreTheToken | Jump to TurnReadAndTokeniseTheCommand_StoreTheToken to skip updating the conjunction count. | ||
| TurnReadAndTokeniseTheCommand_CountConjunctions | 27982 | DEC A | Step the conjunction count down by one. | |
| 27983 | LD (46875),A | Update *46875. | ||
| 27986 | LD A,(IY-2) | Read the previous token byte from IY. | ||
| 27989 | AND 240 | Jump to TurnReadAndTokeniseTheCommand_StoreTheToken if the high nibble of the clause byte at offset -2 is 176. | ||
| 27991 | CP 176 | |||
| 27993 | JR Z,TurnReadAndTokeniseTheCommand_StoreTheToken | |||
| 27995 | CP 160 | Jump to TurnReadAndTokeniseTheCommand_StoreTheToken if the high nibble of the clause byte at offset -2 is 160. | ||
| 27997 | JR Z,TurnReadAndTokeniseTheCommand_StoreTheToken | |||
| 27999 | LD A,176 | Mark this token as a full stop. | ||
| 28001 | LD (IY+0),A | Store the token byte in the buffer at IY. | ||
| 28004 | XOR A | Take zero for the next token byte. | ||
| 28005 | LD (IY+1),A | Store that zero in the token buffer at IY. | ||
| 28008 | INC IY | Step to the next byte of the token buffer. | ||
| 28010 | INC IY | |||
| TurnReadAndTokeniseTheCommand_StoreTheToken | 28012 | LD (IY+0),B | Store the token byte in the buffer at IY. | |
| 28015 | LD (IY+1),C | Store the token's second byte in the buffer at IY. | ||
| 28018 | INC IY | Jump back to TurnReadAndTokeniseTheCommand_TakeTheNextWord unless the class in D is 192. | ||
| 28020 | INC IY | |||
| 28022 | LD A,D | |||
| 28023 | CP 192 | |||
| 28025 | JR NZ,TurnReadAndTokeniseTheCommand_TakeTheNextWord | |||
|
Test the conjunction count.
|
||||
| 28027 | LD A,(46875) | Jump to TurnReadAndTokeniseTheCommand_PointAtTheTokens if *46875 is zero. | ||
| 28030 | AND A | |||
| 28031 | JR Z,TurnReadAndTokeniseTheCommand_PointAtTheTokens | |||
| 28033 | XOR A | Clear *46875. | ||
| 28034 | LD (46875),A | |||
|
Deal with the conjunction before the next line.
|
||||
| 28037 | CALL Inglish_AskWhat_1 | Call Inglish_AskWhat_1 to ask "what ?" and set the action countdown. | ||
| 28040 | JR TurnReadAndTokeniseTheCommand_SetTheLineReadFlag | Jump back to TurnReadAndTokeniseTheCommand_SetTheLineReadFlag to update the line-read flag. | ||
| TurnReadAndTokeniseTheCommand_PointAtTheTokens | 28042 | LD HL,28828 | Point *46812 at 28828. | |
| 28045 | LD (46812),HL | |||
|
Match the tokens against the grammar.
|
||||
| TurnReadAndTokeniseTheCommand_PrepareTheClause | 28048 | CALL InglishPrepareTheClause_0 | Call InglishPrepareTheClause_0 to prepare the clause. | |
| 28051 | JP NZ,TurnReadAndTokeniseTheCommand_SetTheLineReadFlag | Jump back to TurnReadAndTokeniseTheCommand_SetTheLineReadFlag if InglishPrepareTheClause_0 returned with the zero flag clear. | ||
|
Carry out the matched command.
|
||||
| 28054 | CALL InglishApplyAMatch | Call InglishApplyAMatch to apply A match. | ||
|
Test the line-read flag.
|
||||
| 28057 | LD A,(46853) | Jump to TurnReadAndTokeniseTheCommand_PrepareTheClause if *46853 is not zero. | ||
| 28060 | AND A | |||
| 28061 | JR NZ,TurnReadAndTokeniseTheCommand_PrepareTheClause | |||
| 28063 | JP TurnReadAndTokeniseTheCommand_SetTheLineReadFlag | Jump back to TurnReadAndTokeniseTheCommand_SetTheLineReadFlag to update the line-read flag. | ||
| TurnReadAndTokeniseTheCommand_ShowTheUnknownWord | 28066 | LD HL,44435 | Point at the message "i do not know the word " (44435). | |
| 28069 | LD A,1 | Write 1 to WaitCountdown. | ||
| 28071 | LD (46849),A | |||
| 28074 | CALL PrintMessage | Call PrintMessage to print message. | ||
| 28077 | LD HL,(46810) | Read *46810. | ||
| TurnReadAndTokeniseTheCommand_TestForEnter | 28080 | LD A,(HL) | Jump to TurnReadAndTokeniseTheCommand_PrintAQuote if the unknown word is 13. | |
| 28081 | CP 13 | |||
| 28083 | JR Z,TurnReadAndTokeniseTheCommand_PrintAQuote | |||
| 28085 | CP 34 | Jump to TurnReadAndTokeniseTheCommand_PrintAQuote if the unknown word is 34. | ||
| 28087 | JR Z,TurnReadAndTokeniseTheCommand_PrintAQuote | |||
|
Print the character in A.
|
||||
| 28089 | CALL Print_Character | Call Print_Character to print one character. | ||
| 28092 | INC HL | Jump back to TurnReadAndTokeniseTheCommand_TestForEnter if the unknown word is not 32. | ||
| 28093 | CP 32 | |||
| 28095 | JR NZ,TurnReadAndTokeniseTheCommand_TestForEnter | |||
|
Print a quote.
|
||||
| TurnReadAndTokeniseTheCommand_PrintAQuote | 28097 | LD A,34 | Print a quote. | |
| 28099 | CALL Print_Character | |||
|
Print a newline.
|
||||
| 28102 | CALL Print_LineBreak | Call Print_LineBreak to print a newline. | ||
| 28105 | JP TurnReadAndTokeniseTheCommand_SetTheLineReadFlag | Jump back to TurnReadAndTokeniseTheCommand_SetTheLineReadFlag to update the line-read flag. | ||
| Prev: 27853 | Up: Map | Next: 28108 |