Prev: F09A Up: Map Next: F0B7
F09B: Make a teacher find the truant ERIC
The address of this interruptible subcommand routine is placed into bytes 0x09 and 0x0A of a teacher's buffer by the routine at F0BF. 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).
H Teacher's character number (0xC9-0xCB)
F09B LD L,$1D Set bit 7 of byte 0x1D of the teacher's buffer, making him run
F09D SET 7,(HL)
F09F LD L,$00 Byte 0x00 of the teacher's buffer holds his animatory state
F0A1 BIT 0,(HL) Is the teacher midstride?
F0A3 JP NZ,$655E Finish the stride if so
F0A6 LD L,$1D
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 F74D); or ERIC is now where he should be (see below). In either case, the chase is over.
F0A8 BIT 0,(HL) Has the teacher's command list been marked for a restart?
F0AA JP NZ,$7E8F If so, do some post-chase cleanup, remove the address of this routine from bytes 0x09 and 0x0A of the teacher's buffer, and restart the command list
F0AD CALL $7D15 Is ERIC where he should be?
F0B0 JP NZ,$6558 Continue the chase if not
F0B3 SET 0,(HL) Otherwise set bit 0 of byte 0x1D of the teacher's buffer, indicating that the command list should be restarted
F0B5 JR $F0A8 Restart the command list now that the chase is over
Prev: F09A Up: Map Next: F0B7