| Routines

F048: Check whether ERIC and EINSTEIN are in class

Used by the routine at F100. If EINSTEIN is in class, this routine returns to the caller with the zero flag set if and only if ERIC is present too. If EINSTEIN is not yet sitting down in class, it makes the teacher wait until he shows up.
Input
H | Teacher's character number (0xC9-0xCB)
F048 | LD A,($D000) | Pick up EINSTEIN's current animatory state in A
F04B | CP $34 | 0x34: Is EINSTEIN sitting down (i.e. in class)?
F04D | JP Z,$7D15 | Check on ERIC if so
F050 | LD DE,$FFFD | DE=-3
F053 | POP BC | Drop the return address from the stack into BC
F054 | EX DE,HL | Set DE to the address of the CALL F048 instruction in the calling routine
F055 | ADD HL,BC
F056 | EX DE,HL
F057 | LD L,$03 | Place this address into bytes 0x03 and 0x04 of the teacher's buffer, so that we keep returning here (and the teacher stands still) until EINSTEIN arrives in class
F059 | LD (HL),E
F05A | INC L
F05B | LD (HL),D
F05C | RET | Return to the character-moving routine at 62D0