Prev: 9F10 Up: Map Next: 9FDE
9F89: Print the heading for a list of contents
For object A: if it is closed and not dead (bits 3 and 5 of the flags clear), or holds nothing visible, a new line is printed and the routine returns with carry set. Otherwise, for a character, 'X is carrying'; for anything else a heading chosen by the low four bits of byte 4 of the object's record, from the message at AEBD: IN (0), ON (1), BEHIND (2), UNDER (3) or TIED TO (4), followed by 'there is' or 'there are' - so 'behind the heavy curtain there is a wall' and 'under the trap door there is the goblins cache'.
9F89 PUSH IX Save the caller's IX, BC and DE
9F8B PUSH BC
9F8C PUSH DE
9F8D LD C,A C = the object whose contents we are about to introduce
9F8E CALL $9B25 IX = its own record
9F91 LD A,(IX+$07) A = its flags
9F94 AND $28 Keep only whether it is closed and whether it is dead
9F96 JR Z,$9FD8 Neither closed-and-alive nor dead: nothing worth a heading (an ordinary open container falls through here fine; this only stops things that are shut away)
9F98 LD A,C A = the object again
9F99 CALL $9CEC How many visible things does it hold?
9F9C CP $00
9F9E JR Z,$9FD8 None at all: no heading needed either
9FA0 BIT 6,(IX+$07) Is it a living character?
9FA4 JR Z,$9FAD No: use the ordinary IN/ON/BEHIND/UNDER/TIED-TO wording instead
9FA6 LD A,C Yes: push its own number as the message parameter...
9FA7 PUSH AF
9FA8 LD HL,$ACEC ..."X is carrying"
9FAB JR $9FCF Skip the ordinary wording below
9FAD LD HL,$039F "is"
9FB0 DEC A Is there only a single thing inside (so "is" is right rather than "are")?
9FB1 JR Z,$9FB6
9FB3 LD HL,$0065 More than one: "are" instead
9FB6 PUSH HL Push IS or ARE as a message parameter
9FB7 LD L,(IX+$08) HL = the object's own words (so the heading can name it: "in the chest")...
9FBA LD A,(IX+$09)
9FBD AND $0F
9FBF LD H,A
9FC0 PUSH HL ...pushed as another message parameter
9FC1 LD HL,$AEBD HL = the shared IN/ON/BEHIND/UNDER/TIED-TO message
9FC4 LD A,(IX+$04) A = the object's attribute byte, whose low bits say how its contents should be introduced
9FC7 RLCA Shift that containment word up...
9FC8 RLCA
9FC9 AND $3C ...into an index, since each choice of wording is 4 bytes further into the message
9FCB LD E,A
9FCC LD D,$00
9FCE ADD HL,DE HL = the exact wording for this object's own containment style
9FCF CALL $72D4 Print the whole heading
9FD2 AND A Clear the carry flag: there is something to list after all
9FD3 POP DE Restore the caller's DE, BC and IX
9FD4 POP BC
9FD5 POP IX
9FD7 RET
9FD8 CALL $7578 Nothing worth a heading: just move to a new line
9FDB SCF Set the carry flag: there is nothing to list
9FDC JR $9FD3 Join the shared ending above
Prev: 9F10 Up: Map Next: 9FDE