| Routines

6AD9: Deal with ERIC

Called from the main loop at 6767. Deals with ERIC when any of bits 0-4 at 7FFB (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.
6AD9 | CALL $77AC | 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
6ADC | LD A,($7FFB) | Check ERIC's status flags at 7FFB and return with the carry flag reset unless ERIC has been knocked over, or he is firing, hitting, jumping, or being spoken to
6ADF | AND $1F
6AE1 | RET Z
6AE2 | LD HL,$6AD7 | After dealing with ERIC, return to the main loop via the routine at 6AD7 with the carry flag set to indicate that ERIC was dealt with
6AE5 | PUSH HL
6AE6 | BIT 3,A | Is ERIC being spoken to by a little boy?
6AE8 | JP NZ,$F778 | Jump if so
6AEB | CP $10 | Has ERIC been knocked over?
6AED | JP NC,$6AA7 | Jump if so
6AF0 | DEC A | Is ERIC firing a catapult?
6AF1 | JP Z,$F41F | Jump if so
6AF4 | DEC A | Is ERIC hitting?
6AF5 | JP Z,$F4A4 | Jump if so
6AF8 | JP $F533 | ERIC is jumping; deal with him accordingly