Skool Daze Routines
63146: Deal with ERIC when he's writing on a blackboard
Called from the main loop at 26471.
A ASCII code of 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 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 HL=32683, 32689 or 32695 (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 HL=32679 (Reading Room blackboard), 32685 (White Room blackboard), or 32691 (Exam Room blackboard)
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, and set BC=32684 (Reading Room blackboard), 32690 (White Room blackboard), or 32696 (Exam Room blackboard)
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 at 32763 to indicate that ERIC has finished writing on the board, and return to the main loop
63190 RET