| Routines

61595: Make a teacher find the truant ERIC

The address of this interruptible subcommand routine is placed into bytes 9 and 10 of a teacher's buffer by the routine at 61631. It makes the teacher run after and stalk ERIC until he goes to wherever he should be (the dinner hall, the assembly hall, or the classroom).
Input
H | Teacher's character number (201-203)
61595 | LD L,29 | Set bit 7 of byte 29 of the teacher's buffer, making him run
61597 | SET 7,(HL)
61599 | LD L,0 | Byte 0 of the teacher's buffer holds his animatory state
61601 | BIT 0,(HL) | Is the teacher midstride?
61603 | JP NZ,25950 | Finish the stride if so
61606 | LD L,29 |
Now check whether a command list restart has been requested. This request will have been made for one of two reasons: the lesson in which the teacher started chasing ERIC has ended, and the next lesson has just begun (see 63309); or ERIC is now where he should be (see below). In either case, the chase is over.
61608 | BIT 0,(HL) | Has the teacher's command list been marked for a restart?
61610 | JP NZ,32399 | If so, do some post-chase cleanup, remove the address of this routine from bytes 9 and 10 of the teacher's buffer, and restart the command list
61613 | CALL 32021 | Is ERIC where he should be?
61616 | JP NZ,25944 | Continue the chase if not
61619 | SET 0,(HL) | Otherwise set bit 0 of byte 29 of the teacher's buffer, indicating that the command list should be restarted
61621 | JR 61608 | Restart the command list now that the chase is over