Prev: 9D53 Up: Map Next: 9DBD
9D97: How many visible things does object A hold?
Used by the routines at DO_INVENTORY, DO_OPEN, DO_EMPTY, CONTENTS_INTRO and DO_TIE.
Input
A The holder
Output
A The count
COUNT_HELD 9D97 PUSH IX
9D99 PUSH IY
9D9B PUSH BC
9D9C LD B,$00 Count from 0, through every object
9D9E LD IX,$C060
COUNT_HELD_0 9DA2 CALL NEXT_OBJECT_KEEP_A Held by A and visible: count it
9DA5 JR Z,COUNT_HELD_1
9DA7 CP (IY+$01)
9DAA JR NZ,COUNT_HELD_0
9DAC BIT 7,(IY+$07)
9DB0 JR Z,COUNT_HELD_0
9DB2 INC B
9DB3 JP COUNT_HELD_0
COUNT_HELD_1 9DB6 LD A,B
9DB7 POP BC
9DB8 POP IY
9DBA POP IX
9DBC RET
Prev: 9D53 Up: Map Next: 9DBD