Prev: 9B38 Up: Map Next: 9B96
9B6C: Move the contents of an object
Sets the location of every object held by object A to room B, and does the same for their contents. Clears 9B37 if Bilbo (object 0) is one of them.
9B6C PUSH IY Save IY and IX
9B6E PUSH IX
9B70 LD IX,$BF50 IX = just before the start of the object index
9B74 CALL $9B04 Look at the next object; IY = its own record
9B77 JR Z,$9B91 No more objects: finished
9B79 CP (IY+$01) Is it held by the object we are moving?
9B7C JR NZ,$9B74 No: try the next one
9B7E LD (IY+$10),B Yes: its own location becomes room B too
9B81 PUSH AF Save this object's number
9B82 LD A,(IX+$00) Is this object Bilbo himself?
9B85 AND A
9B86 JR NZ,$9B8B
9B88 LD ($9B37),A If so, clear the "Bilbo moved" flag: he has now genuinely been placed in the new room
9B8B CALL $9B6C Recursively move whatever THIS object holds too
9B8E POP AF Restore the object's number
9B8F JR $9B74 Look for more things held by the original object
9B91 POP IX Restore IX and IY
9B93 POP IY
9B95 RET
Prev: 9B38 Up: Map Next: 9B96