Prev: 7B9E Up: Map Next: 7CAC
7C23: Inglish: Score The Swapped Clause
Used by the routine at Inglish_SaveTheClauseWindow.
Swaps the two clause pointers when the conjunction count is odd, then scores that clause against the action table.
Inglish_ScoreTheSwappedClause 7C23 AND A Jump to Inglish_ScoreTheSwappedClause_PackTheTokenClasses if the match result is zero.
7C24 JR Z,Inglish_ScoreTheSwappedClause_PackTheTokenClasses
7C26 LD HL,($795A) Read the pointer stored in the swapped text pointer.
7C29 LD DE,($795C) Read the pointer stored in the other swapped pointer.
7C2D LD ($795A),DE Remember the pointer in the swapped text pointer.
7C31 LD ($795C),HL Remember the pointer in the other swapped pointer.
Inglish_ScoreTheSwappedClause_PackTheTokenClasses 7C34 CALL ClausePackTheActionScores Call ClausePackTheActionScores to pack this action entry's token classes into the clause.
7C37 LD HL,$795A Jump to Inglish_ScoreTheSwappedClause_CompareClauseByte unless the phrase slot is empty.
7C3A LD A,(HL)
7C3B INC HL
7C3C OR (HL)
7C3D JR NZ,Inglish_ScoreTheSwappedClause_CompareClauseByte
7C3F LD A,($B71E) Read *B71E.
7C42 JR Inglish_ScoreTheSwappedClause_FlipBitFive Jump to Inglish_ScoreTheSwappedClause_FlipBitFive because the phrase slot is empty.
Inglish_ScoreTheSwappedClause_CompareClauseByte 7C44 DEC HL Jump to Inglish_ScoreTheSwappedClause_CompareTheNextByte if the swapped clause byte is not the clause byte at offset 0E.
7C45 LD A,(HL)
7C46 CP (IY+$0E)
7C49 JR NZ,Inglish_ScoreTheSwappedClause_CompareTheNextByte
7C4B INC HL Jump to Inglish_ScoreTheSwappedClause_ReadTheScoreByte if the swapped clause byte is the clause byte at offset 0F.
7C4C LD A,(HL)
7C4D CP (IY+$0F)
7C50 JR Z,Inglish_ScoreTheSwappedClause_ReadTheScoreByte
7C52 DEC HL Step back one byte through the swapped text pointer.
Inglish_ScoreTheSwappedClause_CompareTheNextByte 7C53 LD A,(HL) Jump to Inglish_ScoreTheSwappedClause_ReadTheScoreByte if the swapped clause byte is not the clause byte at offset 10.
7C54 CP (IY+$10)
7C57 JR NZ,Inglish_ScoreTheSwappedClause_ReadTheScoreByte
7C59 INC HL Step to the next byte of the swapped text pointer.
7C5A LD A,(HL) Read the swapped clause byte.
7C5B CP (IY+$11) Compare the swapped clause byte with the clause byte at offset 11.
Inglish_ScoreTheSwappedClause_ReadTheScoreByte 7C5E LD A,($B71D) Read *B71D.
7C61 JR NZ,Inglish_ScoreTheSwappedClause_TestTheScoreBit Jump to Inglish_ScoreTheSwappedClause_TestTheScoreBit unless the swapped clause matched the clause bytes at offsets 0E and 0F or at offsets 10 and 11.
Inglish_ScoreTheSwappedClause_FlipBitFive 7C63 XOR $20 Flip the bits selected by 20.
Inglish_ScoreTheSwappedClause_TestTheScoreBit 7C65 BIT 5,A Jump to Inglish_ScoreTheSwappedClause_StoreGrammarCount if bit 5 of the phrase scratch byte is clear.
7C67 LD BC,$1208
7C6A JR Z,Inglish_ScoreTheSwappedClause_StoreGrammarCount
7C6C LD BC,$0812 Store the swapped score bytes 08 and 12.
Inglish_ScoreTheSwappedClause_StoreGrammarCount 7C6F LD HL,$7954 Point HL at the grammar count.
7C72 LD (HL),B Store the saved byte in the grammar count.
7C73 INC HL Step to the next byte of the grammar count.
7C74 LD (HL),C Store the saved byte in the grammar count.
7C75 LD A,B Take the first score byte into A.
7C76 LD DE,$7942 Point DE at the first copy window.
7C79 LD HL,$793D Point HL at the match buffer.
7C7C CALL Inglish_ScoreTheSwappedClause_0 Call Inglish_ScoreTheSwappedClause_0 to score the swapped clause.
7C7F LD A,C Copy 06 bytes from the first copy window to B6E0.
7C80 LD HL,$7942
7C83 LD DE,$B6E0
7C86 LD BC,$0006
7C89 LDIR
7C8B LD DE,$7948 Point DE at the second copy window.
7C8E LD HL,$793E Point HL at the second match buffer.
Inglish_ScoreTheSwappedClause_0 7C91 PUSH BC Save BC and keep A in C.
7C92 LD C,A
7C93 LD B,$00 Start the character count at zero.
7C95 PUSH HL Add 0006 to the second match buffer.
7C96 PUSH IY
7C98 POP HL
7C99 ADD HL,BC
7C9A LD BC,$0006 Copy the prepared bytes.
7C9D LDIR
7C9F XOR A Start the six-byte zero test with A clear.
7CA0 LD B,$06 Count 06 passes.
Inglish_ScoreTheSwappedClause_TestTheMatchBytes 7CA2 DEC HL Step back one byte through the second match buffer.
7CA3 OR (HL) Fold this byte into the test. All six bytes are zero when Z stays set.
7CA4 DJNZ Inglish_ScoreTheSwappedClause_TestTheMatchBytes Loop back to Inglish_ScoreTheSwappedClause_TestTheMatchBytes until 06 runs out.
7CA6 POP HL Return if the six copied bytes are all zero.
7CA7 POP BC
7CA8 RET Z
7CA9 SET 0,(HL) Mark the second match buffer so bit 0 is on.
7CAB RET Return.
View the equivalent code in;
Prev: 7B9E Up: Map Next: 7CAC