Prev: 62925 Up: Map Next: 62966
62926: Guide a character across a floor to his destination
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 left or right across the floor of a building to his final destination.
Input
H Character number (215-229)
62926 LD BC,62694 Point BC at the routine at 62694
This entry point is used by the unused routine at 62966 (with BC=62880) and by the routine at 62971 (with BC=62958: RET).
62929 LD L,0 Point HL at byte 0 of the character's buffer
62931 BIT 0,(HL) Is the character midstride?
62933 JP NZ,60506 If so, move the character from the midstride position and update the SRB
62936 LD L,3 Has this character's command list been marked for a restart?
62938 BIT 4,(HL)
62940 JP NZ,62084 Terminate this subcommand if so (this jump is never made because bit 4 of byte 3 is unused)
62943 LD L,1 Collect the character's x-coordinate from byte 1 of his buffer
62945 LD A,(HL)
62946 LD L,16 Compare this with the character's intermediate or final destination x-coordinate
62948 CP (HL)
62949 JP Z,62084 Terminate this subcommand if they match
62952 PUSH AF Save the carry flag
62953 LD DE,62959 Push the address of the instruction at 62959 (below) onto the stack
62956 PUSH DE
62957 PUSH BC Make an indirect jump to the routine whose address is in BC, and then return to 62959 (below)
62958 RET
62959 POP AF Restore the carry flag
62960 JP C,60334 Make the character move right if he's to the left of his intermediate or final destination
62963 JP 60347 Otherwise make the character move left
Prev: 62925 Up: Map Next: 62966