| Routines

61658: Control a teacher during assembly

Used by command list 80. 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 (201-203)
61658 | LD A,(32740) | Collect the MSB of the lesson clock (which starts off at 16)
61661 | CP 2 | Has the teacher been standing still long enough (the routine at 62032 sets the MSB of the lesson clock to 1 after MR WACKER has finished his detention speech)?
61663 | JP C,25484 | Move to the next command in the command list if so
61666 | CP 11 | Is it time for the kids to sit down for assembly yet?
61668 | RET NC | Return if not
61669 | LD A,H | A=teacher's character number
61670 | CP 201 | Is this MR WITHIT (who does assembly duty)?
61672 | RET NZ | Return if not
61673 | LD DE,32640 | Set bits 6 (ERIC should be here now) and 7 (time to sit down: this is checked by command lists 20, 40 and 88) at 32640
61676 | LD A,(DE)
61677 | OR 192
61679 | LD (DE),A
61680 | LD A,(32740) | A=MSB of the lesson clock
61683 | CP 10 | Is it time to find ERIC if he's absent?
61685 | RET NC | Return if not
61686 | CALL 32021 | Is ERIC in the assembly hall?
61689 | RET Z | Return if so
61690 | JP 61648 | Go and find him otherwise