![]() |
Routines |
| Prev: 82B3 | Up: Map | Next: 83A0 |
|
Used by the routine at CommandDispatchAControl.
Follows the grammar flag for a special key. A clear bit 7 copies ten grammar bytes, otherwise four, and the replay path is then scored.
|
||||
| Command_FollowTheGrammarFlag | 82F7 | JP Z,Inglish_CopyTenGrammarBytes | Jump back to Inglish_CopyTenGrammarBytes if bit 7 of the grammar flag is clear. | |
| 82FA | JP Inglish_CopyFourGrammarBytes | Jump to Inglish_CopyFourGrammarBytes to clear bit 6 and copy the grammar bytes. | ||
| Command_FollowTheGrammarFlag_Loop | 82FD | LD A,D | Use the class being matched again. | |
| 82FE | LD ($824F),A | Store the result at 824F. | ||
| 8301 | PUSH DE | Save DE, BC and IY, and read *B706. | ||
| 8302 | PUSH BC | |||
| 8303 | PUSH IY | |||
| 8305 | LD A,($B706) | |||
| 8308 | LD ($8250),A | Remember the replay flag from B706 at 8250. | ||
| 830B | LD DE,$FFE8 | Step back one 18-byte parser record. | ||
| 830E | ADD IY,DE | Add FFE8 onto this record. | ||
| 8310 | LD A,$01 | Pass 01 on to the grammar scorer at InglishPrepareTheClause_1. | ||
| 8312 | JP InglishPrepareTheClause_1 | Jump back to InglishPrepareTheClause_1 to update the conjunction count. | ||
|
Test the conjunction count. Reached through the special-key table at 8271, dispatched from Command_MatchASpecialKey.
|
||||
| 8315 | LD A,($B71B) | Jump to Command_FollowTheGrammarFlag_Loop if *B71B is zero. | ||
| 8318 | AND A | |||
| 8319 | JR Z,Command_FollowTheGrammarFlag_Loop | |||
| 831B | DEC A | Step the conjunction count down by one. | ||
| 831C | LD ($B71B),A | Update *B71B. | ||
| 831F | LD A,($8250) | Read the saved class. | ||
| 8322 | LD B,A | Copy the result into B. | ||
| 8323 | LD A,($B706) | Read *B706. | ||
| 8326 | SUB B | Clear C and jump to Command_FollowTheGrammarFlag_ClearTheMatcherPhase if the replay flag equals the saved class. | ||
| 8327 | AND A | |||
| 8328 | LD C,$00 | |||
| 832A | JR Z,Command_FollowTheGrammarFlag_ClearTheMatcherPhase | |||
| 832C | POP IY | Restore the parser pointer from the stack, keeping a copy there. | ||
| 832E | PUSH IY | |||
| 8330 | LD DE,$FFE8 | Step back one 18-byte parser record. | ||
| 8333 | ADD IY,DE | Add FFE8 onto this record. | ||
| 8335 | LD B,A | Use the difference as the record count in B. | ||
| Command_FollowTheGrammarFlag_PointAtTheSlots | 8336 | LD IX,$B738 | Point at the first character slot at B738. | |
| 833A | PUSH DE | Each character slot at B738 is 19 bytes. | ||
| 833B | PUSH BC | |||
| 833C | LD DE,$0019 | |||
| 833F | LD B,$08 | Count 08 passes. | ||
| Command_FollowTheGrammarFlag_SkipAUsedSlot | 8341 | LD A,(IX+$00) | Jump to Command_FollowTheGrammarFlag_ClaimTheSlot if this character slot is empty. | |
| 8344 | AND A | |||
| 8345 | JR Z,Command_FollowTheGrammarFlag_ClaimTheSlot | |||
| 8347 | ADD IX,DE | Step to the next 19-byte character slot. | ||
| 8349 | DJNZ Command_FollowTheGrammarFlag_SkipAUsedSlot | Loop back to Command_FollowTheGrammarFlag_SkipAUsedSlot until 08 runs out. | ||
| Command_FollowTheGrammarFlag_ClaimTheSlot | 834B | LD (IX+$00),$FF | Claim this free slot with FF. | |
| 834F | INC IX | Step to the next byte of this character slot. | ||
| 8351 | POP BC | Jump to Command_FollowTheGrammarFlag_ClearTheMatcherPhase if every character slot is in use. | ||
| 8352 | POP DE | |||
| 8353 | JR NZ,Command_FollowTheGrammarFlag_ClearTheMatcherPhase | |||
| 8355 | BIT 6,(IY+$01) | Jump to Command_FollowTheGrammarFlag_CopyTheRecord if bit 6 of byte 1 of this record is clear. | ||
| 8359 | JR Z,Command_FollowTheGrammarFlag_CopyTheRecord | |||
| 835B | LD (IX-$01),$00 | Clear the previous byte of this entry. | ||
| 835F | JR Command_FollowTheGrammarFlag_StepBackOneRecord | Jump to Command_FollowTheGrammarFlag_StepBackOneRecord to update the matcher phase. | ||
| Command_FollowTheGrammarFlag_CopyTheRecord | 8361 | PUSH BC | Count 18 passes. | |
| 8362 | LD B,$18 | |||
| Command_FollowTheGrammarFlag_CopyTheNextByte | 8364 | LD A,(IY+$00) | Copy the next byte into this entry. | |
| 8367 | LD (IX+$00),A | |||
| 836A | INC IY | Step to the next byte of this record. | ||
| 836C | INC IX | Step to the next byte of this character slot. | ||
| 836E | DJNZ Command_FollowTheGrammarFlag_CopyTheNextByte | Loop back to Command_FollowTheGrammarFlag_CopyTheNextByte until 18 runs out. | ||
| 8370 | POP BC | Restore the record count, and step IY back 18 bytes to the start of this record. | ||
| 8371 | ADD IY,DE | |||
| Command_FollowTheGrammarFlag_StepBackOneRecord | 8373 | ADD IY,DE | Step IY back 18 bytes to the previous record. | |
| 8375 | INC C | Count one more character slot. | ||
| 8376 | DJNZ Command_FollowTheGrammarFlag_PointAtTheSlots | Decrease the record count in B and loop back to Command_FollowTheGrammarFlag_PointAtTheSlots until it is zero. | ||
| Command_FollowTheGrammarFlag_ClearTheMatcherPhase | 8378 | XOR A | Clear *B719. | |
| 8379 | LD ($B719),A | |||
| 837C | LD A,C | Copy the count in C into A. | ||
| 837D | LD ($B737),A | Store the number of claimed slots at B737. | ||
| 8380 | POP IY | Restore the parser pointer from the stack and restore the replay flag from 8250. | ||
| 8382 | LD A,($8250) | |||
| 8385 | LD ($B706),A | Update *B706. | ||
| 8388 | POP BC | Restore the saved pair from the stack and read the class from 824F. | ||
| 8389 | POP DE | |||
| 838A | LD A,($824F) | |||
| 838D | LD D,A | Keep the saved class. | ||
| 838E | JP InglishPrepareTheClause_3 | Jump back to InglishPrepareTheClause_3 to clear the matcher scratch. | ||
|
Reached through the special-key table at 8271, dispatched from Command_MatchASpecialKey.
|
||||
| 8391 | CALL GameOver_Start | Call GameOver_Start to print the score. | ||
| Command_FollowTheGrammarFlag_WaitForAKey | 8394 | XOR A | Select every keyboard row (A=00). | |
| 8395 | IN A,($FE) | Read port FE into A. | ||
| 8397 | AND %00011111 | Jump back to Command_FollowTheGrammarFlag_WaitForAKey while the low five bits are all set. | ||
| 8399 | CP %00011111 | |||
| 839B | JR Z,Command_FollowTheGrammarFlag_WaitForAKey | |||
| 839D | JP Restart | Jump back to Restart to restart the game. | ||
| Prev: 82B3 | Up: Map | Next: 83A0 |