| Routines

F400: Make a teacher conduct a question-and-answer session

Used by the routine at F300. Controls the teacher during a question-and-answer session, but hands control back to the routine at F300 if ERIC goes missing.
Input
H | Teacher's character number (0xA3-0xA6)
F400 | LD L,$64 | Replace the primary command routine address in bytes 0x63 and 0x64 of the teacher's buffer with F400 (this routine)
F402 | LD (HL),$F4
F404 | CALL $7CD0 | Is ERIC in the room?
F407 | JR Z,$F410 | Jump if so
ERIC is absent.
F409 | LD L,$64 | Replace the address of this primary command routine in bytes 0x63 and 0x64 of the teacher's buffer with that of F300
F40B | LD (HL),$F3
F40D | JP $F305 | Make EINSTEIN tell the teacher that ERIC is not in class
ERIC is in class, so fire off a question and answer.
F410 | CALL $7A32 | Prepare a question and the answer
F413 | LD BC,$7986 | Hand over control to the routine at 7986, making the teacher ask the question
F416 | CALL $7CF1
Control returns here when the teacher has finished asking the question.
F419 | EX DE,HL | Transfer the teacher's character number to D
F41A | CALL $7CB6 | Make the teacher wait for EINSTEIN to answer the question
F41D | JR $F404 |