| Routines

6F00: Check whether a character was or can be punched by ERIC or ANGELFACE

Used by the routines at 6F1E and 6F99. On entry, E holds the x-coordinate of the spot three spaces in front of ANGELFACE to check whether it's worth raising his fist (6F1E), or the x-coordinate of the spot two spaces in front of ERIC or ANGELFACE when he has already raised his fist (6F99). Returns with the carry flag set if the potential victim is at the target coordinates and is facing the right way.
Input
C | Punching character's animatory state
D | Punching character's y-coordinate
E | Target x-coordinate (2 or 3 spaces in front of the punching character)
H | Character number of the potential victim (0x98-0xAC)
6F00 | LD L,$62 | Byte 0x62 of a character's buffer holds his x-coordinate
6F02 | LD A,(HL) | Pick this up in A
6F03 | CP E | Is this character at the target x-coordinate?
6F04 | JR Z,$6F08 | Jump if so
6F06 | AND A | Reset the carry flag to indicate absence of character
6F07 | RET |
6F08 | DEC L | Byte 0x61 holds the character's y-coordinate
6F09 | LD A,(HL) | Pick this up in A
6F0A | CP D | Is this character at the target y-coordinate?
6F0B | JR NZ,$6F06 | Jump if not
The character being checked has been found at the target coordinates. But is he facing the right way?
6F0D | DEC L | Byte 0x60 holds the character's animatory state
6F0E | LD A,(HL) | Pick this up in A
6F0F | XOR C | Now A=0x80 if the character and puncher are facing each other, and 0x00 otherwise
6F10 | AND $80
6F12 | RET Z | Return if the character's not facing the puncher
6F13 | LD L,$70 | Is there an uninterruptible subcommand routine address in bytes 0x6F and 0x70 of the potential victim's buffer (i.e. is he not in a punchable state at the moment)?
6F15 | LD A,(HL)
6F16 | AND A
6F17 | RET NZ | Return with the carry flag reset if so
6F18 | SCF | Set the carry flag to indicate the presence of a ripe target
6F19 | RET |