Prev: F650 Up: Map Next: F6D7
F6AA: Deal with ERIC when he's writing on a blackboard
Called from the main loop at 6767 when bit 5 of ERIC's status flags at 7FFB is set (by the routine at F650).
Input
A ASCII code of the last keypress
HL 7FFB (ERIC's status flags)
F6AA CP $0D Was ENTER pressed?
F6AC JR Z,$F6D4 Jump if so
F6AE LD B,A Store the keypress code in B
F6AF LD H,$AC 0xAC=ERIC
F6B1 CALL $7128 C=0xAB (Reading Room blackboard), 0xB1 (White Room blackboard) or 0xB7 (Exam Room blackboard)
F6B4 SUB $B3
F6B6 LD C,A
F6B7 ADD A,A
F6B8 ADD A,C
F6B9 LD C,A
F6BA LD L,A Point HL at byte 3 of the relevant blackboard contents buffer)
F6BB LD H,$7F
F6BD BIT 7,(HL) Jump if 4 or more characters have been written so far, or the board was dirty before ERIC started writing
F6BF JR Z,$F6CA
F6C1 SUB $04 Point HL at the byte preceding the first byte of the relevant blackboard contents buffer
F6C3 LD L,A
F6C4 INC L Find the next 'open' slot (which will have bit 7 set) in the blackboard contents buffer
F6C5 BIT 7,(HL)
F6C7 JR Z,$F6C4
F6C9 LD (HL),B Store the keypress code in the blackboard contents buffer
F6CA INC C Restore the keypress code to A; set BC=7FAC (Reading Room blackboard), 7FB2 (White Room blackboard), or 7FB8 (Exam Room blackboard) (which holds the pixel coordinates at which ERIC should write)
F6CB LD A,B
F6CC LD B,$7F
F6CE CALL $715F Write a single character on the blackboard
F6D1 JP $F693 Move ERIC's arm
ERIC has finished writing on the board (ENTER was pressed).
F6D4 RES 5,(HL) Reset bit 5 of ERIC's status flags at 7FFB to indicate that ERIC has finished writing on the board
F6D6 RET Return to the main loop
Prev: F650 Up: Map Next: F6D7