Prev: 7111 Up: Map Next: 71CC
7122: Report the action ("you attack thorin with the sword.")
Prints the sentence that describes what an actor has just done, for example 'you go east.', 'thorin attacks you.', 'gandalf opens the round green door.' or 'you attack thorin with the short strong sword.'. It is built from the entry for the current action (number in B5D8) in the action table AA47, whose four word slots hold the verb, a particle, a preposition and (for movement) GO.
The flags collected by 70EA decide what is printed. If bit 4 of them is set the action is silent and nothing is printed at all.
Otherwise the actor's name is printed (739E: 'you', 'thorin', 'gandalf'...). If the action was only being tried and would have failed (B5EC is 0) the word CANNOT is inserted, so the report reads 'you cannot open the door'. The verb follows (74B1). For the ten movement actions a special case applies when the actor is a character and the move is not possible: the word SOMEWHERE is printed instead of the direction. Then, as the flags require, the particle, the target object (73AB, with its article) and the preposition plus instrument (73BE) are added. The sentence ends with a full stop and a new line.
The printing is done with 70D6 set to 1, which makes 7436 use 'the' rather than 'a' for articles. $B5F2 is set when the action is only being tried, which sends the text to the lower window instead (see 7580).
7122 LD A,$01 A = 1
7124 LD ($70D6),A Store A in the "definite article" flag
7127 XOR A A = 0
7128 LD ($B5F4),A Store A in the "print an article" flag
712B PUSH IY Save IY
712D PUSH BC Save BC
712E LD A,($B5EC) A = the "it would work" flag
7131 LD B,A B = A
7132 AND A Is A zero?
7133 LD A,$01 A = 1
7135 JR Z,$7138 If it is zero, go to 7138
7137 XOR A A = 0
7138 LD ($B5F2),A Store A in the lower-window flag
713B PUSH IX Save IX
713D PUSH HL Save HL
713E PUSH DE Save DE
713F LD A,($B5D8) IX = the action table entry
7142 CALL $70DF Call: Get the address of an action table entry (70DF)
7145 PUSH HL Save HL
7146 POP IX Restore IX
7148 XOR A Only start a new line for the player when the action really happens
7149 CP B Compare with B
714A JR Z,$7153 If yes, go to 7153
714C LD A,($B5DB) A = the actor
714F AND A Is A zero?
7150 CALL Z,$7578 If zero/equal: print a new line
7153 CALL $70EA Get the flags; bit 4 set means say nothing
7156 BIT 4,A Test bit 4 of A
7158 LD C,A C = A
7159 JP NZ,$71C0 If the bit is set, go to 71C0
715C CALL $739E Print the actor
715F LD DE,$00EE "cannot" if the action would not work
7162 XOR A A = 0
7163 CP B Compare with B
7164 CALL Z,$74B8 If zero/equal: call: Print a dictionary word (74B8)
7167 PUSH HL Save HL
7168 LD DE,$0006 DE = 6
716B ADD HL,DE Add HL,DE
716C CALL $74B1 Print the verb
716F CALL $954D A character that cannot move goes "somewhere"
7172 POP HL Restore HL
7173 JR NC,$7186 If the routine returned with carry reset, go to 7186
7175 LD A,($B5D8) A = the action
7178 CP $0B Is it action 11 (STRIKE WITH)?
717A JR NC,$7186 If A >= 11, go to 7186
717C LD DE,$0AEA DE = $0AEA
717F INC HL Increment HL
7180 INC HL Increment HL
7181 CALL $74B8 Call: Print a dictionary word (74B8)
7184 JR $7189 Continue at 7189
7186 CALL $74B1 Call: Print a word from a list (74B1)
7189 BIT 3,C Target wanted?
718B JR Z,$719D If the bit is clear, go to 719D
718D BIT 5,C Test bit 5 of C
718F CALL NZ,$74B1 If not zero/not equal: call: Print a word from a list (74B1)
7192 LD A,($B60E) A = the action's second flags
7195 BIT 7,A Test bit 7 of A
7197 CALL NZ,$74B1 If not zero/not equal: call: Print a word from a list (74B1)
719A CALL $73AB Call: 73AB
719D LD A,($B5DA) Instrument wanted?
71A0 CP $FF Is it nobody ($FF)?
71A2 JR Z,$71B8 If yes, go to 71B8
71A4 BIT 2,C Test bit 2 of C
71A6 JR Z,$71B8 If the bit is clear, go to 71B8
71A8 BIT 5,C Test bit 5 of C
71AA CALL Z,$74B1 If zero/equal: call: Print a word from a list (74B1)
71AD LD A,($B60E) A = the action's second flags
71B0 BIT 7,A Test bit 7 of A
71B2 CALL Z,$74B1 If zero/equal: call: Print a word from a list (74B1)
71B5 CALL $73BE Call: Print the instrument (73BE)
71B8 LD A,$2E End the sentence
71BA CALL $7580 Print the character in A
71BD CALL $7578 Print a new line
71C0 XOR A A = 0
71C1 LD ($70D6),A Store A in the "definite article" flag
71C4 POP DE Restore DE
71C5 POP HL Restore HL
71C6 POP IX Restore IX
71C8 POP BC Restore BC
71C9 POP IY Restore IY
71CB RET Done
Prev: 7111 Up: Map Next: 71CC