| Routines

653E: Check whether Sam can roll or somersault from his current location

Used by the routine at 64BD. Returns to the caller if Sam can roll or somersault from his current location; otherwise returns to the main loop.
653E | LD H,$E6 | 0xE6=Sam
6540 | CALL $EAF8 | Is Sam on the sidewalk or the road?
6543 | JR C,$6555 | Jump if not
6545 | LD L,$00 | Point HL at byte 0x00 of Sam's buffer
6547 | BIT 7,(HL) | Reset the zero flag if Sam is facing right
6549 | INC HL | Point HL at byte 0x01 of Sam's buffer
654A | LD A,(HL) | A=Sam's x-coordinate
654B | JR NZ,$6552 | Jump if Sam is facing right
654D | CP $04 | Return if Sam is facing left and his x-coordinate is >= 4
654F | RET NC
6550 | JR C,$6555 | Jump if Sam is facing left and his x-coordinate is < 4
6552 | CP $FA | Return if Sam is facing right and his x-coordinate is < 250
6554 | RET C
6555 | POP BC | Drop the return address from the stack
6556 | POP BC | Drop the address of the animation phase table from the stack
6557 | RET | Return to the main loop at F06D