Prev: F5B6 Up: Map Next: F5D9
F5B9: Check whether ERIC is standing on a boy who's been knocked out
Used by the routine at F533. Returns with the carry flag set if ERIC is standing on a boy.
Input
B 11 (there are 11 little boys)
D 1 + ERIC's y-coordinate
E ERIC's x-coordinate
H 0x98 (little boy no. 1)
F5B9 LD C,E Set E=x-1 and C=x+2 where x is ERIC's x-coordinate; any boy with an x-coordinate in this range is a potential step for ERIC
F5BA DEC E
F5BB INC C
F5BC INC C
F5BD LD L,$61 Byte 0x61 of the boy's buffer holds his y-coordinate
This entry point is also used by the routine at F533 with H=0xA7 (BOY WANDER) and B=0x03 (and E and C already set as above).
F5BF LD A,D A=y+1 (y=ERIC's y-coordinate)
F5C0 CP (HL) Is there a boy at this y-coordinate?
F5C1 JR NZ,$F5D4 Jump if not
F5C3 DEC L Collect the boy's animatory state from byte 0x60 of his buffer
F5C4 LD A,(HL)
F5C5 INC L L=0x61
F5C6 AND $0F Keep only bits 0-3 of the animatory state
F5C8 CP $07 Is the boy lying flat on his back?
F5CA JR NZ,$F5D4 Jump if not
F5CC INC L Collect the boy's x-coordinate from byte 0x62 of his buffer
F5CD LD A,(HL)
F5CE DEC L L=0x61
F5CF CP E Return with the carry flag set if ERIC is standing on this boy; otherwise continue
F5D0 JR C,$F5D4
F5D2 CP C
F5D3 RET C
F5D4 INC H Next boy
F5D5 DJNZ $F5BF Jump back until all the boys have been checked
F5D7 AND A Return with the carry flag reset to indicate that ERIC is not standing on a boy
F5D8 RET
Prev: F5B6 Up: Map Next: F5D9