Prev: F5A0 Up: Map Next: F5CD
F5AC: Guide a character up or down staircases
The address of this interruptible subcommand routine is placed into bytes 0x0E and 0x0F of a character's buffer by the routine at F600. It guides the character down to the first floor of a building (so that he can then leave it on the way to his final destination), or up to the floor he is heading for.
H Character number (0xD7-0xE5)
F5AC LD L,$00 Point HL at byte 0x00 of the character's buffer
F5AE BIT 0,(HL) Is the character midstride?
F5B0 JP NZ,$EC5A If so, move the character from the midstride position and update the SRB
F5B3 LD L,$03 Has this character's command list been marked for a restart?
F5B5 BIT 4,(HL)
F5B7 JP NZ,$F284 Terminate this subcommand if so (this jump is never made because bit 4 of byte 0x03 is unused)
F5BB LD A,(HL) A=character's y-coordinate
F5BC LD L,$10 Compare it with the y-coordinate of the character's intermediate or final destination
F5BF JP Z,$F284 Terminate this subcommand if they match
F5C2 PUSH AF Save the carry flag
F5C3 CALL $F485 Make the character consider flipping a light switch
F5C6 POP AF Restore the carry flag
F5C7 JP C,$EBA0 Make the character move down if he's above the level of his destination
F5CA JP $EB9B Otherwise make the character move up
Prev: F5A0 Up: Map Next: F5CD