Prev: 9FAF Up: Map Next: A050
9FC7: List what object A holds, or with A = $FF what lies loose in location B
Used by the routine at LIST_HERE.
Each thing is named and followed by a full stop, and then -- unless CONTENTS_INTRO says otherwise -- whatever it holds is listed after it, two places further in: the indent is kept at INDENT, and this calls itself. Left out: the actor itself, anything out of the actor's reach, and loose things that are in more than one place at once, which are the doors and other fixtures -- EXITS_THROUGH has already told of those.
Input
A The holder, or $FF
B The location
D The indent
Output
C How many were listed, added on
LIST_HELD 9FC7 PUSH HL Indent by D, keeping the old indent
9FC8 LD L,A
9FC9 LD A,(INDENT)
9FCC LD H,A
9FCD LD A,D
9FCE LD (INDENT),A
9FD1 LD A,L
9FD2 EX (SP),HL
9FD3 PUSH IX Walk every object
9FD5 LD IX,$C060
LIST_HELD_0 9FD9 CALL NEXT_OBJECT_KEEP_A Next object held by A
9FDC JR Z,LIST_HELD_6
9FDE CP (IY+$01)
9FE1 JR NZ,LIST_HELD_0
9FE3 PUSH AF Loose and in several places? Leave it out. Otherwise, is it in location B, first or second of its places?
9FE4 INC A
9FE5 LD E,(IY+$00)
9FE8 JR NZ,LIST_HELD_1
9FEA LD A,$01
9FEC CP E
9FED JR NZ,LIST_HELD_4
LIST_HELD_1 9FEF LD A,(IY+$10)
9FF2 CP B
9FF3 JR Z,LIST_HELD_2
9FF5 DEC E
9FF6 JR Z,LIST_HELD_4
9FF8 LD A,(IY+$11)
9FFB CP B
9FFC JR NZ,LIST_HELD_4
LIST_HELD_2 9FFE LD A,(ACTING) Not the actor, at the top level
A001 CP (IX+$00)
A004 JR NZ,LIST_HELD_3
A006 LD A,$04
A008 CP D
A009 JR Z,LIST_HELD_4
LIST_HELD_3 A00B LD A,(IX+$00) Out of reach? Leave it out
A00E CALL IN_REACH
A011 JR Z,LIST_HELD_4
A013 INC C Count it, and name it
A014 SUB A
A015 LD (CAPITAL_NEXT),A
A018 LD (NOUN_ONLY),A
A01B CALL PRINT_RECORD_NAME
A01E LD A,(ACTING) The actor itself: LIST_HELD_5
A021 CP (IX+$00)
A024 JR Z,LIST_HELD_5
A026 LD A,$2E A full stop
A028 CALL PRINT_CHAR
A02B LD A,(IX+$00) And what it holds, two further in
A02E CALL CONTENTS_INTRO
A031 JR C,LIST_HELD_4
A033 LD A,(IX+$00)
A036 PUSH DE
A037 INC D
A038 INC D
A039 CALL LIST_HELD
A03C POP DE
LIST_HELD_4 A03D POP AF On to the next
A03E JP LIST_HELD_0
LIST_HELD_5 A041 CALL NEW_LINE
A044 JR LIST_HELD_4
LIST_HELD_6 A046 POP IX
A048 EX (SP),HL
A049 LD A,H
A04A LD (INDENT),A
A04D LD A,L
A04E POP HL
A04F RET
Prev: 9FAF Up: Map Next: A050