Prev: A468 Up: Map Next: A4C3
A486: CLIMB INTO (the barrel, the chest or the boat)
The actor must not already be inside. The container must be open, and big enough: unless its size is $FF (unlimited), it must be larger than the actor plus everything the actor carries (9C3D), or 'you are too big'. Then the container becomes the actor's holder, and the actor goes wherever it goes (9B38) - which is how Bilbo escapes in the barrel (A4F4).
A486 LD IY,($B5FC) IY = the actor's own record
A48A LD A,($B5D9) Is the actor already inside the target?
A48D CP (IY+$01)
A490 JP Z,$9EBF Yes: fail with the usual message
A493 LD A,($B5DB) A = how much the actor can carry...
A496 CALL $9C3D ...plus how much the actor is already carrying
A499 ADD A,(IY+$02)
A49C JR C,$A4A0 Overflowed past 255? Then treat the actor as unmeasurably big
A49E LD A,$FF
A4A0 LD B,A B = the actor's own total size, for the check below
A4A1 LD IX,($B5F8) IX = the target's (the container's) own record
A4A5 CALL $A4C3 Is it open?
A4A8 JP Z,$A09C No: say so and stop
A4AB LD A,(IX+$02) A = the container's own capacity
A4AE CP $FF Is it unlimited?
A4B0 JR Z,$A4B9 Yes: skip the size check
A4B2 SUB B No: is the actor too big to fit?
A4B3 LD HL,$B030 "you are too big."
A4B6 JP NC,$72D4 Too big: say so and stop
A4B9 CALL $9C99 Dry run? Then stop here: it would work
A4BC LD A,($B5D9) The actor becomes held by the target...
A4BF LD (IY+$01),A ...so wherever the target goes, the actor goes too
A4C2 RET
Prev: A468 Up: Map Next: A4C3