Prev: 28954 Up: Map Next: 29141
28971: Inglish: Describe The Action
Prints the sentence for the current action: who, the verb, and the objects. Bit 4 of the packed token classes (46877) suppresses the whole sentence. What the other bits select is only partly confirmed.
Decide whether a sentence is due, and which noun it names.
Inglish_DescribeTheAction 28971 LD A,1 Mark a class token as due.
28973 LD (28895),A
28976 XOR A Clear which noun is being named.
28977 LD (46851),A
28980 PUSH IY The action countdown is 1 when the message-suppressed flag is clear, and 0 when a message was held back.
28982 PUSH BC
28983 LD A,(46843)
28986 LD B,A
28987 AND A
28988 LD A,1
28990 JR Z,Inglish_DescribeTheAction_Store
28992 XOR A Clear the countdown when the message-suppressed flag was set.
Inglish_DescribeTheAction_Store 28993 LD (46849),A Store the action countdown.
28996 PUSH IX Look up the record for the current action.
28998 PUSH HL
28999 PUSH DE
29000 LD A,(46823)
29003 CALL IndexAction
29006 PUSH HL Use that action record from here on.
29007 POP IX
29009 XOR A Jump to Inglish_DescribeTheAction_Pack to skip the newline if the message-suppressed flag was zero.
29010 CP B
29011 JR Z,Inglish_DescribeTheAction_Pack
29013 LD A,(46826) Print a newline if it is the player's turn.
29016 AND A
29017 CALL Z,Print_LineBreak
Inglish_DescribeTheAction_Pack 29020 CALL ClausePackTheActionScores Call ClausePackTheActionScores to pack this action entry's token classes into the clause.
29023 BIT 4,A Jump to Inglish_DescribeTheAction_Done if bit 4 of the packed token classes (46877) is set. That bit suppresses the sentence.
29025 LD C,A
29026 JP NZ,Inglish_DescribeTheAction_Done
Inglish_DescribeTheAction_Who 29029 CALL Message_PrintWhoseTurn_0 Print the current character.
29032 LD DE,238 Print the token CANNOT when the message-suppressed flag is zero.
29035 XOR A
29036 CP B
29037 CALL Z,PrintToken
29040 PUSH HL Keep the pointer those prints returned, and step 6 bytes, the length of an object name.
29041 LD DE,6
29044 ADD HL,DE
29045 CALL PrintAction Print the action's name.
29048 CALL LocationLit Test whether the location is lit.
29051 POP HL Jump to Inglish_DescribeTheAction_Verb if the location is lit.
29052 JR NC,Inglish_DescribeTheAction_Verb
29054 LD A,(46823) Jump to Inglish_DescribeTheAction_Verb if the action is strike (11) or later.
29057 CP 11
29059 JR NC,Inglish_DescribeTheAction_Verb
29061 LD DE,2794 Take the token SOMEWHERE.
29064 INC HL Step two bytes to the next word token.
29065 INC HL
29066 CALL PrintToken Print that token.
29069 JR Inglish_DescribeTheAction_Object Jump to Inglish_DescribeTheAction_Object, skipping a second copy of the action name.
Inglish_DescribeTheAction_Verb 29071 CALL PrintAction Print the action's name.
Inglish_DescribeTheAction_Object 29074 BIT 3,C Jump to Inglish_DescribeTheAction_Second if bit 3 of the scores ClausePackTheActionScores left in C is clear.
29076 JR Z,Inglish_DescribeTheAction_Second
29078 BIT 5,C Print the action's name again if bit 5 of the packed scores is set.
29080 CALL NZ,PrintAction
29083 LD A,(46878) Print the action's name again if bit 7 of the clause byte is set.
29086 BIT 7,A
29088 CALL NZ,PrintAction
29091 CALL Message_PrintTheObject_0 Print the current object.
Inglish_DescribeTheAction_Second 29094 LD A,(46825) Jump to Inglish_DescribeTheAction_Stop if there is no second object.
29097 CP 255
29099 JR Z,Inglish_DescribeTheAction_Stop
29101 BIT 2,C Jump to Inglish_DescribeTheAction_Stop if bit 2 of the packed token classes (46877) is clear.
29103 JR Z,Inglish_DescribeTheAction_Stop
29105 BIT 5,C Print the action's name if bit 5 of the packed scores is clear.
29107 CALL Z,PrintAction
29110 LD A,(46878) Print the action's name if bit 7 of the clause byte is clear.
29113 BIT 7,A
29115 CALL Z,PrintAction
29118 CALL Message_PrintTheSecondNoun_0 Print the second noun.
Inglish_DescribeTheAction_Stop 29121 LD A,46 Print a full stop.
29123 CALL Print_Character
29126 CALL Print_LineBreak Print a newline.
Inglish_DescribeTheAction_Done 29129 XOR A Clear the class-token flag.
29130 LD (28895),A
29133 POP DE Restore DE, HL, IX, BC and IY from the stack.
29134 POP HL
29135 POP IX
29137 POP BC
29138 POP IY
29140 RET Return.
Prev: 28954 Up: Map Next: 29141