Prev: 9BCD Up: Map Next: 9BF4
9BDF: Is object A inside the holder at (HL)?
Follows the chain of holders of object A upwards; returns with carry set if (HL) is one of them.
9BDF CALL $9B25 IX = object A's own record
9BE2 PUSH AF Save the object's number for later
9BE3 LD A,(IX+$01) A = whoever (or whatever) is holding it
9BE6 CP $FF Is it held by nobody at all?
9BE8 JR Z,$9BF1 Yes: it cannot be inside the thing we are looking for
9BEA POP IX No: throw away the saved object number from the stack (using IX only because it is a spare place to put it; A itself, still holding the holder's number, is untouched)
9BEC CP (HL) Is that holder the very thing we are testing against (the byte stored at HL)?
9BED JR NZ,$9BDF Not yet: look inside the holder in turn, in case the object is nested more than one level deep
9BEF SCF Found it: set the carry flag to say so
9BF0 RET
9BF1 POP AF Not held by anybody: restore the stack (the AF we saved earlier)
9BF2 AND A Clear the carry flag: not inside
9BF3 RET
Prev: 9BCD Up: Map Next: 9BF4