Prev: 63137 Up: Map Next: 63152
63138: Calculate the x-coordinate of the front column of a character's sprite
Used by the routines at 27892, 30822 and 63152. 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 (215-230)
63138 LD L,0 Point HL at byte 0 of the character's buffer
63140 LD A,(HL) A=character's animatory state
63141 RLCA Set the carry flag if the character is facing left, reset it if he's facing right
63142 CCF
63143 SBC A,A Now A=0 if the character is facing left, or 2 if he's facing right
63144 INC A
63145 ADD A,A
63146 INC L Point HL at byte 1 of the character's buffer
63147 ADD A,(HL) Add the character's x-coordinate
63148 LD C,A C=x-coordinate of the front column of the character's sprite
63149 AND 7 A=C%8, with the zero flag if this is 0
63151 RET
Prev: 63137 Up: Map Next: 63152