Prev: 24133 Up: Map Next: 24236
24175: Deal with ERIC when he's writing on a blackboard
This routine is called by the routine at 63405 when bit 4 at 32763 is set (by the routine at 24133).
24175 LD HL,32755 32755 holds ERIC's main action timer
24178 DEC (HL) Is it time to deal with ERIC yet?
24179 RET NZ Return if not
24180 LD HL,53760 Point HL at byte 0 of ERIC's buffer
24183 LD A,(HL) A=ERIC's animatory state
24184 RRCA Is ERIC's arm up?
24185 JR NC,24204 Jump if not
24187 CALL 62221 Make a sound effect and update the SRB
24190 LD HL,32727 Copy the code of the last key pressed from 32727 to A
24193 LD A,(HL)
24194 CP 13 Was ENTER pressed?
24196 JP Z,24028 Compare ERIC's scribblings with the bike and storeroom combinations if so
24199 LD A,86 Message 86: DON'T TOUCH BLACKBOARDS
24201 JP 63640 Make any teacher within range give ERIC lines
24204 CALL 29118 Get the ASCII code of the last keypress in A
24207 RET Z Return if no keys were pressed
24208 LD HL,32727 Store this keypress code in 32727 (so it can be collected on the next pass through this routine)
24211 LD (HL),A
24212 INC L L=identifier of the board ERIC is writing on (84, 90, 96, 102 or 108)
24213 LD L,(HL)
24214 INC L Point HL at byte 1 of the blackboard buffer
24215 LD B,4 There are 4 slots available in the blackboard buffer
24217 INC L Point HL at the next slot
24218 BIT 7,(HL) Is this slot in the blackboard buffer available to store the keypress?
24220 JR NZ,24226 Jump if so
24222 DJNZ 24217 Otherwise check the remaining slots
24224 JR 24227 Jump if there were no remaining slots
24226 LD (HL),A Store the keypress code in the blackboard buffer
24227 CP 13 Set the zero flag if ENTER was pressed
24229 LD H,210 210=ERIC
24231 CALL NZ,26516 Write a character on the board unless ENTER was pressed
24234 JR 24165 Raise ERIC's arm and update the SRB
Prev: 24133 Up: Map Next: 24236