| Routines

62905: Check whether ERIC is standing on a boy who's been knocked out

Used by the routine at 62771. 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 | 152 (little boy no. 1)
62905 | 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
62906 | DEC E
62907 | INC C
62908 | INC C
62909 | LD L,97 | Byte 97 of the boy's buffer holds his y-coordinate
This entry point is also used by the routine at 62771 with H=167 (BOY WANDER) and B=3 (and E and C already set as above).
62911 | LD A,D | A=y+1 (y=ERIC's y-coordinate)
62912 | CP (HL) | Is there a boy at this y-coordinate?
62913 | JR NZ,62932 | Jump if not
62915 | DEC L | Collect the boy's animatory state from byte 96 of his buffer
62916 | LD A,(HL)
62917 | INC L | L=97
62918 | AND 15 | Keep only bits 0-3 of the animatory state
62920 | CP 7 | Is the boy lying flat on his back?
62922 | JR NZ,62932 | Jump if not
62924 | INC L | Collect the boy's x-coordinate from byte 98 of his buffer
62925 | LD A,(HL)
62926 | DEC L | L=97
62927 | CP E | Return with the carry flag set if ERIC is standing on this boy; otherwise continue
62928 | JR C,62932
62930 | CP C
62931 | RET C
62932 | INC H | Next boy
62933 | DJNZ 62911 | Jump back until all the boys have been checked
62935 | AND A | Return with the carry flag reset to indicate that ERIC is not standing on a boy
62936 | RET