Prev: 9B37 Up: Map Next: 9B6C
9B38: Move an object and everything it holds
Moves everything held by object A (and everything they hold, recursively, 9B6C) to room B. If Bilbo was among the things moved (for example he was inside the barrel when it floated away, or was carried off), the room he has arrived in is entered and described (the entry at 8DC1 in 8D19).
Input
A Object
B Room
9B38 LD HL,$9B37 Assume, for now, that Bilbo is among the things being moved
9B3B LD (HL),$01
9B3D CALL $9B6C Move everything object A holds into room B (this clears the flag above if Bilbo is not actually among them)
9B40 LD A,(HL) Was Bilbo actually moved?
9B41 AND A
9B42 RET NZ No: nothing more to do
9B43 PUSH HL Yes: save the flag's own address
9B44 LD A,($B5DB) Save the current actor...
9B47 PUSH AF
9B48 LD HL,($B5FC) ...and the current actor's record
9B4B PUSH HL
9B4C LD HL,$C00B Make Bilbo the actor for a moment...
9B4F LD ($B5FC),HL
9B52 XOR A
9B53 LD ($B5DB),A
9B56 LD A,B ...and pretend he has just moved in direction B (used only to set the "destination room" variable read below)
9B57 LD ($8D17),A
9B5A CALL $8DC1 Enter the new room and describe it, exactly as an ordinary move does
9B5D CALL $9A5D Update where Bilbo is, for the rest of this turn
9B60 POP HL Restore the real actor's record...
9B61 LD ($B5FC),HL
9B64 POP AF ...and the real actor
9B65 LD ($B5DB),A
9B68 POP HL Restore the flag's address
9B69 XOR A Clear it, ready for next time
9B6A LD (HL),A
9B6B RET
Prev: 9B37 Up: Map Next: 9B6C