Prev: 9D86 Up: Map Next: 9DC8
9D92: Are two objects in the same place?
Returns with Z reset if the object at IY is visible (bit 7 of its flags) and is in the same place as the object at IX.
Each object's outermost holder is found with 9DC8, which returns $FF for an object lying loose in a room and 0 for one that is shut inside something (or held by a living character). If the results differ, the objects are not together. If both are loose, IX's room must be one of IY's locations. If both are 0, the room comparison is skipped and they count as together - see the bug note.
9D92 BIT 7,(IY+$07) Is the IY object visible at all?
9D96 RET Z No: return with Z set
9D97 PUSH IY
9D99 PUSH IX
9D9B PUSH BC
9D9C LD C,(IX+$10) C = the IX object's room
9D9F PUSH IY
9DA1 CALL $9DC8 Where is the IY object ultimately?
9DA4 LD B,A
9DA5 POP IX
9DA7 CALL $9DC8 Where is the IX object ultimately?
9DAA CP B The same answer?
9DAB JR NZ,$9DBD No: not together
9DAD INC A Both shut inside something ($00)?
9DAE JR NZ,$9DC0 Then count them as together
9DB0 LD B,(IY+$00) Both loose: is the IX object's room one of the IY object's locations?
9DB3 LD A,C
9DB4 CP (IY+$10)
9DB7 JR Z,$9DC0 Yes: together
9DB9 INC IY
9DBB DJNZ $9DB4
9DBD XOR A Not together: Z set
9DBE JR $9DC2
9DC0 OR $01 Together: Z reset
9DC2 POP BC
9DC3 POP IX
9DC5 POP IY
9DC7 RET
Prev: 9D86 Up: Map Next: 9DC8