| Routines

27353: Deal with ERIC

Called from the main loop at 26471. Deals with ERIC when any of bits 0-4 at 32763 (ERIC's status flags) are set. Returns with the carry flag set if and only if ERIC was dealt with, indicating that there is no need to check keypresses in the main loop.
27353 | CALL 30636 | Make any nearby teachers give ERIC lines if he's not where he should be, or standing or sitting when or where he shouldn't be
27356 | LD A,(32763) | Check ERIC's status flags at 32763 and return with the carry flag reset unless ERIC has been knocked over, or he is firing, hitting, jumping, or being spoken to
27359 | AND 31
27361 | RET Z
27362 | LD HL,27351 | After dealing with ERIC, return to the main loop via the routine at 27351 with the carry flag set to indicate that ERIC was dealt with
27365 | PUSH HL
27366 | BIT 3,A | Is ERIC being spoken to by a little boy?
27368 | JP NZ,63352 | Jump if so
27371 | CP 16 | Has ERIC been knocked over?
27373 | JP NC,27303 | Jump if so
27376 | DEC A | Is ERIC firing a catapult?
27377 | JP Z,62495 | Jump if so
27380 | DEC A | Is ERIC hitting?
27381 | JP Z,62628 | Jump if so
27384 | JP 62771 | ERIC is jumping; deal with him accordingly