![]() |
Routines |
| Prev: 33459 | Up: Map | Next: 33696 |
|
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 | 33527 | JP Z,Inglish_CopyTenGrammarBytes | Jump back to Inglish_CopyTenGrammarBytes if bit 7 of the grammar flag is clear. | |
| 33530 | JP Inglish_CopyFourGrammarBytes | Jump to Inglish_CopyFourGrammarBytes to clear bit 6 and copy the grammar bytes. | ||
| Command_FollowTheGrammarFlag_Loop | 33533 | LD A,D | Use the class being matched again. | |
| 33534 | LD (33359),A | Store the result at 33359. | ||
| 33537 | PUSH DE | Save DE, BC and IY, and read *46854. | ||
| 33538 | PUSH BC | |||
| 33539 | PUSH IY | |||
| 33541 | LD A,(46854) | |||
| 33544 | LD (33360),A | Remember the replay flag from 46854 at 33360. | ||
| 33547 | LD DE,65512 | Step back one 24-byte parser record. | ||
| 33550 | ADD IY,DE | Add 65512 onto this record. | ||
| 33552 | LD A,1 | Pass 1 on to the grammar scorer at InglishPrepareTheClause_1. | ||
| 33554 | JP InglishPrepareTheClause_1 | Jump back to InglishPrepareTheClause_1 to update the conjunction count. | ||
|
Test the conjunction count. Reached through the special-key table at 33393, dispatched from Command_MatchASpecialKey.
|
||||
| 33557 | LD A,(46875) | Jump to Command_FollowTheGrammarFlag_Loop if *46875 is zero. | ||
| 33560 | AND A | |||
| 33561 | JR Z,Command_FollowTheGrammarFlag_Loop | |||
| 33563 | DEC A | Step the conjunction count down by one. | ||
| 33564 | LD (46875),A | Update *46875. | ||
| 33567 | LD A,(33360) | Read the saved class. | ||
| 33570 | LD B,A | Copy the result into B. | ||
| 33571 | LD A,(46854) | Read *46854. | ||
| 33574 | SUB B | Clear C and jump to Command_FollowTheGrammarFlag_ClearTheMatcherPhase if the replay flag equals the saved class. | ||
| 33575 | AND A | |||
| 33576 | LD C,0 | |||
| 33578 | JR Z,Command_FollowTheGrammarFlag_ClearTheMatcherPhase | |||
| 33580 | POP IY | Restore the parser pointer from the stack, keeping a copy there. | ||
| 33582 | PUSH IY | |||
| 33584 | LD DE,65512 | Step back one 24-byte parser record. | ||
| 33587 | ADD IY,DE | Add 65512 onto this record. | ||
| 33589 | LD B,A | Use the difference as the record count in B. | ||
| Command_FollowTheGrammarFlag_PointAtTheSlots | 33590 | LD IX,46904 | Point at the first character slot at 46904. | |
| 33594 | PUSH DE | Each character slot at 46904 is 25 bytes. | ||
| 33595 | PUSH BC | |||
| 33596 | LD DE,25 | |||
| 33599 | LD B,8 | Count 8 passes. | ||
| Command_FollowTheGrammarFlag_SkipAUsedSlot | 33601 | LD A,(IX+0) | Jump to Command_FollowTheGrammarFlag_ClaimTheSlot if this character slot is empty. | |
| 33604 | AND A | |||
| 33605 | JR Z,Command_FollowTheGrammarFlag_ClaimTheSlot | |||
| 33607 | ADD IX,DE | Step to the next 25-byte character slot. | ||
| 33609 | DJNZ Command_FollowTheGrammarFlag_SkipAUsedSlot | Loop back to Command_FollowTheGrammarFlag_SkipAUsedSlot until 8 runs out. | ||
| Command_FollowTheGrammarFlag_ClaimTheSlot | 33611 | LD (IX+0),255 | Claim this free slot with 255. | |
| 33615 | INC IX | Step to the next byte of this character slot. | ||
| 33617 | POP BC | Jump to Command_FollowTheGrammarFlag_ClearTheMatcherPhase if every character slot is in use. | ||
| 33618 | POP DE | |||
| 33619 | JR NZ,Command_FollowTheGrammarFlag_ClearTheMatcherPhase | |||
| 33621 | BIT 6,(IY+1) | Jump to Command_FollowTheGrammarFlag_CopyTheRecord if bit 6 of byte 1 of this record is clear. | ||
| 33625 | JR Z,Command_FollowTheGrammarFlag_CopyTheRecord | |||
| 33627 | LD (IX-1),0 | Clear the previous byte of this entry. | ||
| 33631 | JR Command_FollowTheGrammarFlag_StepBackOneRecord | Jump to Command_FollowTheGrammarFlag_StepBackOneRecord to update the matcher phase. | ||
| Command_FollowTheGrammarFlag_CopyTheRecord | 33633 | PUSH BC | Count 24 passes. | |
| 33634 | LD B,24 | |||
| Command_FollowTheGrammarFlag_CopyTheNextByte | 33636 | LD A,(IY+0) | Copy the next byte into this entry. | |
| 33639 | LD (IX+0),A | |||
| 33642 | INC IY | Step to the next byte of this record. | ||
| 33644 | INC IX | Step to the next byte of this character slot. | ||
| 33646 | DJNZ Command_FollowTheGrammarFlag_CopyTheNextByte | Loop back to Command_FollowTheGrammarFlag_CopyTheNextByte until 24 runs out. | ||
| 33648 | POP BC | Restore the record count, and step IY back 24 bytes to the start of this record. | ||
| 33649 | ADD IY,DE | |||
| Command_FollowTheGrammarFlag_StepBackOneRecord | 33651 | ADD IY,DE | Step IY back 24 bytes to the previous record. | |
| 33653 | INC C | Count one more character slot. | ||
| 33654 | DJNZ Command_FollowTheGrammarFlag_PointAtTheSlots | Decrease the record count in B and loop back to Command_FollowTheGrammarFlag_PointAtTheSlots until it is zero. | ||
| Command_FollowTheGrammarFlag_ClearTheMatcherPhase | 33656 | XOR A | Clear *46873. | |
| 33657 | LD (46873),A | |||
| 33660 | LD A,C | Copy the count in C into A. | ||
| 33661 | LD (46903),A | Store the number of claimed slots at 46903. | ||
| 33664 | POP IY | Restore the parser pointer from the stack and restore the replay flag from 33360. | ||
| 33666 | LD A,(33360) | |||
| 33669 | LD (46854),A | Update *46854. | ||
| 33672 | POP BC | Restore the saved pair from the stack and read the class from 33359. | ||
| 33673 | POP DE | |||
| 33674 | LD A,(33359) | |||
| 33677 | LD D,A | Keep the saved class. | ||
| 33678 | JP InglishPrepareTheClause_3 | Jump back to InglishPrepareTheClause_3 to clear the matcher scratch. | ||
|
Reached through the special-key table at 33393, dispatched from Command_MatchASpecialKey.
|
||||
| 33681 | CALL GameOver_Start | Call GameOver_Start to print the score. | ||
| Command_FollowTheGrammarFlag_WaitForAKey | 33684 | XOR A | Select every keyboard row (A=0). | |
| 33685 | IN A,(254) | Read port 254 into A. | ||
| 33687 | AND %00011111 | Jump back to Command_FollowTheGrammarFlag_WaitForAKey while the low five bits are all set. | ||
| 33689 | CP %00011111 | |||
| 33691 | JR Z,Command_FollowTheGrammarFlag_WaitForAKey | |||
| 33693 | JP Restart | Jump back to Restart to restart the game. | ||
| Prev: 33459 | Up: Map | Next: 33696 |