Prev: 5E45 Up: Map Next: 5EAC
5E6F: Deal with ERIC when he's writing on a blackboard
This routine is called by the routine at F7AD when bit 4 at 7FFB is set (by the routine at 5E45).
5E6F LD HL,$7FF3 7FF3 holds ERIC's main action timer
5E72 DEC (HL) Is it time to deal with ERIC yet?
5E73 RET NZ Return if not
5E74 LD HL,$D200 Point HL at byte 0x00 of ERIC's buffer
5E77 LD A,(HL) A=ERIC's animatory state
5E78 RRCA Is ERIC's arm up?
5E79 JR NC,$5E8C Jump if not
5E7B CALL $F30D Make a sound effect and update the SRB
5E7E LD HL,$7FD7 Copy the code of the last key pressed from 7FD7 to A
5E81 LD A,(HL)
5E82 CP $0D Was ENTER pressed?
5E84 JP Z,$5DDC Compare ERIC's scribblings with the bike and storeroom combinations if so
5E87 LD A,$56 Message 0x56: DON'T TOUCH BLACKBOARDS
5E89 JP $F898 Make any teacher within range give ERIC lines
5E8C CALL $71BE Get the ASCII code of the last keypress in A
5E8F RET Z Return if no keys were pressed
5E90 LD HL,$7FD7 Store this keypress code in 7FD7 (so it can be collected on the next pass through this routine)
5E93 LD (HL),A
5E94 INC L L=identifier of the board ERIC is writing on (0x54, 0x5A, 0x60, 0x66 or 0x6C)
5E95 LD L,(HL)
5E96 INC L Point HL at byte 1 of the blackboard buffer
5E97 LD B,$04 There are 4 slots available in the blackboard buffer
5E99 INC L Point HL at the next slot
5E9A BIT 7,(HL) Is this slot in the blackboard buffer available to store the keypress?
5E9C JR NZ,$5EA2 Jump if so
5E9E DJNZ $5E99 Otherwise check the remaining slots
5EA0 JR $5EA3 Jump if there were no remaining slots
5EA2 LD (HL),A Store the keypress code in the blackboard buffer
5EA3 CP $0D Set the zero flag if ENTER was pressed
5EA5 LD H,$D2 0xD2=ERIC
5EA7 CALL NZ,$6794 Write a character on the board unless ENTER was pressed
5EAA JR $5E65 Raise ERIC's arm and update the SRB
Prev: 5E45 Up: Map Next: 5EAC