| Routines

63146: Deal with ERIC when he's writing on a blackboard

Called from the main loop at 26471 when bit 5 of ERIC's status flags at 32763 is set (by the routine at 63056).
Input
A | ASCII code of the last keypress
HL | 32763 (ERIC's status flags)
63146 | CP 13 | Was ENTER pressed?
63148 | JR Z,63188 | Jump if so
63150 | LD B,A | Store the keypress code in B
63151 | LD H,172 | 172=ERIC
63153 | CALL 28968 | C=171 (Reading Room blackboard), 177 (White Room blackboard) or 183 (Exam Room blackboard)
63156 | SUB 179
63158 | LD C,A
63159 | ADD A,A
63160 | ADD A,C
63161 | LD C,A
63162 | LD L,A | Point HL at byte 3 of the relevant blackboard contents buffer)
63163 | LD H,127
63165 | BIT 7,(HL) | Jump if 4 or more characters have been written so far, or the board was dirty before ERIC started writing
63167 | JR Z,63178
63169 | SUB 4 | Point HL at the byte preceding the first byte of the relevant blackboard contents buffer
63171 | LD L,A
63172 | INC L | Find the next 'open' slot (which will have bit 7 set) in the blackboard contents buffer
63173 | BIT 7,(HL)
63175 | JR Z,63172
63177 | LD (HL),B | Store the keypress code in the blackboard contents buffer
63178 | INC C | Restore the keypress code to A; set BC=32684 (Reading Room blackboard), 32690 (White Room blackboard), or 32696 (Exam Room blackboard) (which holds the pixel coordinates at which ERIC should write)
63179 | LD A,B
63180 | LD B,127
63182 | CALL 29023 | Write a single character on the blackboard
63185 | JP 63123 | Move ERIC's arm
ERIC has finished writing on the board (ENTER was pressed).
63188 | RES 5,(HL) | Reset bit 5 of ERIC's status flags at 32763 to indicate that ERIC has finished writing on the board
63190 | RET | Return to the main loop