Prev: 31646 Up: Map Next: 31916
31779: 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 31779 AND A Jump to Inglish_ScoreTheSwappedClause_PackTheTokenClasses if the match result is zero.
31780 JR Z,Inglish_ScoreTheSwappedClause_PackTheTokenClasses
31782 LD HL,(31066) Read the pointer stored in the swapped text pointer.
31785 LD DE,(31068) Read the pointer stored in the other swapped pointer.
31789 LD (31066),DE Remember the pointer in the swapped text pointer.
31793 LD (31068),HL Remember the pointer in the other swapped pointer.
Inglish_ScoreTheSwappedClause_PackTheTokenClasses 31796 CALL ClausePackTheActionScores Call ClausePackTheActionScores to pack this action entry's token classes into the clause.
31799 LD HL,31066 Jump to Inglish_ScoreTheSwappedClause_CompareClauseByte unless the phrase slot is empty.
31802 LD A,(HL)
31803 INC HL
31804 OR (HL)
31805 JR NZ,Inglish_ScoreTheSwappedClause_CompareClauseByte
31807 LD A,(46878) Read *46878.
31810 JR Inglish_ScoreTheSwappedClause_FlipBitFive Jump to Inglish_ScoreTheSwappedClause_FlipBitFive because the phrase slot is empty.
Inglish_ScoreTheSwappedClause_CompareClauseByte 31812 DEC HL Jump to Inglish_ScoreTheSwappedClause_CompareTheNextByte if the swapped clause byte is not the clause byte at offset 14.
31813 LD A,(HL)
31814 CP (IY+14)
31817 JR NZ,Inglish_ScoreTheSwappedClause_CompareTheNextByte
31819 INC HL Jump to Inglish_ScoreTheSwappedClause_ReadTheScoreByte if the swapped clause byte is the clause byte at offset 15.
31820 LD A,(HL)
31821 CP (IY+15)
31824 JR Z,Inglish_ScoreTheSwappedClause_ReadTheScoreByte
31826 DEC HL Step back one byte through the swapped text pointer.
Inglish_ScoreTheSwappedClause_CompareTheNextByte 31827 LD A,(HL) Jump to Inglish_ScoreTheSwappedClause_ReadTheScoreByte if the swapped clause byte is not the clause byte at offset 16.
31828 CP (IY+16)
31831 JR NZ,Inglish_ScoreTheSwappedClause_ReadTheScoreByte
31833 INC HL Step to the next byte of the swapped text pointer.
31834 LD A,(HL) Read the swapped clause byte.
31835 CP (IY+17) Compare the swapped clause byte with the clause byte at offset 17.
Inglish_ScoreTheSwappedClause_ReadTheScoreByte 31838 LD A,(46877) Read *46877.
31841 JR NZ,Inglish_ScoreTheSwappedClause_TestTheScoreBit Jump to Inglish_ScoreTheSwappedClause_TestTheScoreBit unless the swapped clause matched the clause bytes at offsets 14 and 15 or at offsets 16 and 17.
Inglish_ScoreTheSwappedClause_FlipBitFive 31843 XOR 32 Flip the bits selected by 32.
Inglish_ScoreTheSwappedClause_TestTheScoreBit 31845 BIT 5,A Jump to Inglish_ScoreTheSwappedClause_StoreGrammarCount if bit 5 of the phrase scratch byte is clear.
31847 LD BC,4616
31850 JR Z,Inglish_ScoreTheSwappedClause_StoreGrammarCount
31852 LD BC,2066 Store the swapped score bytes 8 and 18.
Inglish_ScoreTheSwappedClause_StoreGrammarCount 31855 LD HL,31060 Point HL at the grammar count.
31858 LD (HL),B Store the saved byte in the grammar count.
31859 INC HL Step to the next byte of the grammar count.
31860 LD (HL),C Store the saved byte in the grammar count.
31861 LD A,B Take the first score byte into A.
31862 LD DE,31042 Point DE at the first copy window.
31865 LD HL,31037 Point HL at the match buffer.
31868 CALL Inglish_ScoreTheSwappedClause_0 Call Inglish_ScoreTheSwappedClause_0 to score the swapped clause.
31871 LD A,C Copy 6 bytes from the first copy window to 46816.
31872 LD HL,31042
31875 LD DE,46816
31878 LD BC,6
31881 LDIR
31883 LD DE,31048 Point DE at the second copy window.
31886 LD HL,31038 Point HL at the second match buffer.
Inglish_ScoreTheSwappedClause_0 31889 PUSH BC Save BC and keep A in C.
31890 LD C,A
31891 LD B,0 Start the character count at zero.
31893 PUSH HL Add 0006 to the second match buffer.
31894 PUSH IY
31896 POP HL
31897 ADD HL,BC
31898 LD BC,6 Copy the prepared bytes.
31901 LDIR
31903 XOR A Start the six-byte zero test with A clear.
31904 LD B,6 Count 6 passes.
Inglish_ScoreTheSwappedClause_TestTheMatchBytes 31906 DEC HL Step back one byte through the second match buffer.
31907 OR (HL) Fold this byte into the test. All six bytes are zero when Z stays set.
31908 DJNZ Inglish_ScoreTheSwappedClause_TestTheMatchBytes Loop back to Inglish_ScoreTheSwappedClause_TestTheMatchBytes until 6 runs out.
31910 POP HL Return if the six copied bytes are all zero.
31911 POP BC
31912 RET Z
31913 SET 0,(HL) Mark the second match buffer so bit 0 is on.
31915 RET Return.
View the equivalent code in;
Prev: 31646 Up: Map Next: 31916