| Routines

F0DA: Control a teacher during assembly

Used by command list 0x50. Makes the teacher stand still until the period is nearly over, and also perform assembly duty (if the teacher is MR WITHIT).
Input
H | Teacher's character number (0xC9-0xCB)
F0DA | LD A,($7FE4) | Collect the MSB of the lesson clock (which starts off at 0x10)
F0DD | CP $02 | Has the teacher been standing still long enough (the routine at F250 sets the MSB of the lesson clock to 1 after MR WACKER has finished his detention speech)?
F0DF | JP C,$638C | Move to the next command in the command list if so
F0E2 | CP $0B | Is it time for the kids to sit down for assembly yet?
F0E4 | RET NC | Return if not
F0E5 | LD A,H | A=teacher's character number
F0E6 | CP $C9 | Is this MR WITHIT (who does assembly duty)?
F0E8 | RET NZ | Return if not
F0E9 | LD DE,$7F80 | Set bits 6 (ERIC should be here now) and 7 (time to sit down: this is checked by command lists 0x14, 0x28 and 0x58) at 7F80
F0EC | LD A,(DE)
F0ED | OR $C0
F0EF | LD (DE),A
F0F0 | LD A,($7FE4) | A=MSB of the lesson clock
F0F3 | CP $0A | Is it time to find ERIC if he's absent?
F0F5 | RET NC | Return if not
F0F6 | CALL $7D15 | Is ERIC in the assembly hall?
F0F9 | RET Z | Return if so
F0FA | JP $F0D0 | Go and find him otherwise