| Routines

31162: Control EINSTEIN during class (1)

Used by command lists 144, 152, 160 and 168. Makes EINSTEIN wait for his turn to speak, and then hands over control to the interruptible subcommand routine at 31116; when EINSTEIN has finished speaking, control returns to the primary command routine at 31178.
Input
H | 169 (EINSTEIN)
31162 | LD A,(32713) | Pick up the lesson signal flags from 32713
31165 | RLCA | Is it EINSTEIN's turn to speak yet?
31166 | RET NC | Return if not
31167 | LD L,99 | Replace the address of this primary command routine in bytes 99 and 100 of EINSTEIN's buffer with that of 31178 (so that we go there after EINSTEIN has finished speaking)
31169 | LD (HL),202
31171 | LD L,106 | Set the routine address MSB in byte 106 of EINSTEIN's buffer to that of 31116; the LSB will be set later
31173 | LD (HL),121
31175 | JP 31110 | Make EINSTEIN join the queue to speak