Prev: 31145 Up: Map Next: 31252
31158: Inglish: Score The Current Action
Used by the routines at InglishApplyAMatch and Inglish_SaveTheClauseAndAct.
Scores the current action against the action table, stores the winning action and object, and clears the message gate.
Update the second object.
Inglish_ScoreTheCurrentAction 31158 LD A,255 Write 255 to *46825 and *CurrentObject.
31160 LD (46825),A
31163 LD (46824),A
31166 CALL Inglish_ClearTheMatchBuffer Call Inglish_ClearTheMatchBuffer to clear the match buffer.
31169 CALL Inglish_SaveTheClauseWindow Call Inglish_SaveTheClauseWindow to save the clause window.
31172 RET Z Return if Inglish_SaveTheClauseWindow found no match.
31173 LD A,1 The first action id is 1.
31175 PUSH IX Turn the action-table pointer into an offset from Actions.
31177 POP HL
31178 LD DE,43859
31181 SBC HL,DE
31183 JR Z,Inglish_ScoreTheCurrentAction_UpdateCurrentAction Jump to Inglish_ScoreTheCurrentAction_UpdateCurrentAction if the pointer is the action table.
31185 LD DE,8 Each action record is 8 bytes.
Inglish_ScoreTheCurrentAction_CountOnFromOne 31188 INC A Count on from 1.
31189 SBC HL,DE Take 8 off the offset.
31191 JR NZ,Inglish_ScoreTheCurrentAction_CountOnFromOne Jump back to Inglish_ScoreTheCurrentAction_CountOnFromOne until the offset is used up (each 8 bytes is one more action id).
Inglish_ScoreTheCurrentAction_UpdateCurrentAction 31193 LD (46823),A Update *CurrentAction.
31196 LD (46822),A Update *46822.
31199 LD (31070),IX Remember this record in the grammar object pointer.
31203 CALL Inglish_SplitTheClauseFlags Call Inglish_SplitTheClauseFlags to split the clause flags.
31206 CALL Inglish_NoteTheFirstNoun Call Inglish_NoteTheFirstNoun to note the first noun.
31209 XOR A Clear *46842.
31210 LD (46842),A
31213 LD A,(46877) Read *46877.
31216 AND 12 Jump to Inglish_ScoreTheCurrentAction_ClearTheZeroFlag when bits 2 and 3 of the phrase scratch are clear.
31218 JR Z,Inglish_ScoreTheCurrentAction_ClearTheZeroFlag
31220 LD A,(31058) Read the saved phrase byte.
31223 LD (46876),A Update *46876.
31226 RLCA Expose the high bit of the saved phrase byte.
31227 AND 1 Keep only bit 0.
31229 LD (31059),A Update the phrase-byte flag.
Inglish_ScoreTheCurrentAction_ResolveTheFirstNoun 31232 CALL Inglish_ResolveTheFirstNoun Call Inglish_ResolveTheFirstNoun to resolve the first noun.
31235 JP NZ,Inglish_CopyTheParserSlot_ReadTheConjunctionCount Jump to Inglish_CopyTheParserSlot_ReadTheConjunctionCount if Inglish_ResolveTheFirstNoun returned with the zero flag clear (a grammar marker was not 1).
Test the phrase scratch byte.
31238 LD A,(46876) Jump to Inglish_ScoreTheCurrentAction_ClearTheZeroFlag if *46876 is zero.
31241 AND A
31242 JR Z,Inglish_ScoreTheCurrentAction_ClearTheZeroFlag
31244 CALL Inglish_SearchThePreviousSlot Call Inglish_SearchThePreviousSlot to search the previous slot.
31247 JR NZ,Inglish_ScoreTheCurrentAction_ResolveTheFirstNoun Jump back to Inglish_ScoreTheCurrentAction_ResolveTheFirstNoun if Inglish_SearchThePreviousSlot found the current object in the previous parser record.
Inglish_ScoreTheCurrentAction_ClearTheZeroFlag 31249 OR 1 Clear the zero flag.
31251 RET Return.
Prev: 31145 Up: Map Next: 31252