| Routines

62892: Guide a character up or down staircases

The address of this interruptible subcommand routine is placed into bytes 14 and 15 of a character's buffer by the routine at 62976. 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.
Input
H | Character number (215-229)
62892 | LD L,0 | Point HL at byte 0 of the character's buffer
62894 | BIT 0,(HL) | Is the character midstride?
62896 | JP NZ,60506 | If so, move the character from the midstride position and update the SRB
62899 | LD L,3 | Has this character's command list been marked for a restart?
62901 | BIT 4,(HL)
62903 | JP NZ,62084 | Terminate this subcommand if so (this jump is never made because bit 4 of byte 3 is unused)
62906 | DEC L | L=2
62907 | LD A,(HL) | A=character's y-coordinate
62908 | LD L,16 | Compare it with the y-coordinate of the character's intermediate or final destination
62910 | CP (HL)
62911 | JP Z,62084 | Terminate this subcommand if they match
62914 | PUSH AF | Save the carry flag
62915 | CALL 62597 | Make the character consider flipping a light switch
62918 | POP AF | Restore the carry flag
62919 | JP C,60320 | Make the character move down if he's above the level of his destination
62922 | JP 60315 | Otherwise make the character move up