| Routines

F6A2: Calculate the x-coordinate of the front column of a character's sprite

Used by the routines at 6CF4, 7866 and F6B0. Returns with C holding the x-coordinate of the front column of a character's sprite (that is, the left column if he's facing left, or the right column if he's facing right), A holding the remainder when C is divided by 8, and the zero flag set if the remainder is 0.
Input
H | Character number (0xD7-0xE6)
F6A2 | LD L,$00 | Point HL at byte 0x00 of the character's buffer
F6A4 | LD A,(HL) | A=character's animatory state
F6A5 | RLCA | Set the carry flag if the character is facing left, reset it if he's facing right
F6A6 | CCF
F6A7 | SBC A,A | Now A=0 if the character is facing left, or 2 if he's facing right
F6A8 | INC A
F6A9 | ADD A,A
F6AA | INC L | Point HL at byte 0x01 of the character's buffer
F6AB | ADD A,(HL) | Add the character's x-coordinate
F6AC | LD C,A | C=x-coordinate of the front column of the character's sprite
F6AD | AND $07 | A=C%8, with the zero flag if this is 0
F6AF | RET |