| Routines

5E45: 'W' pressed - write on a blackboard

The address of this routine is found in the table of keypress handling routines at E550. It is called from the main loop at F6EA when 'W' is pressed.
5E45 | LD H,$D2 | 0xD2=ERIC
5E47 | CALL $6755 | Collect info about the board ERIC's standing at (if any)
5E4A | RET C | Return if ERIC's not standing at a blackboard
5E4B | LD HL,$7FD8 | Copy the blackboard identifier (0x54, 0x5A, 0x60, 0x66 or 0x6C) from B to 7FD8
5E4E | LD (HL),B
5E4F | DEC L | While ERIC is writing on the board, 7FD7 will be used to store the ASCII code of the last character written; initialise this with something other than 0x0D (ENTER)
5E50 | LD (HL),L
5E51 | LD L,B | Point HL at the first byte of the blackboard's buffer, which usually holds the number of the next clean pixel column
5E52 | LD (HL),$01 | ERIC will start writing at pixel column 1 (regardless of what's already been written on the board)
5E54 | INC L | A=number of the character who last wrote on this board, or 0 if it's clean
5E55 | LD A,(HL)
5E56 | LD (HL),$D2 | Signal: ERIC wrote on this board
5E58 | LD B,$04 | There are 4 digits or letters in the bike and storeroom combinations
5E5A | CPL | A=0x80 if the board is clean, 0x00 otherwise
5E5B | AND $80
5E5D | INC L | Prepare 4 spaces in bytes 2-5 of the blackboard buffer for combination letters/numbers, with bit 7 set if the board is clean
5E5E | LD (HL),A
5E5F | DJNZ $5E5D
5E61 | LD L,$FB | HL=7FFB (ERIC's status flags)
5E63 | LD (HL),$10 | Set bit 4: ERIC is writing on a blackboard
This entry point is used by the routine at 5E6F.
5E65 | LD H,$D2 | 0xD2=ERIC
5E67 | CALL $61B4 | Update the SRB for ERIC's current animatory state
5E6A | OR $07 | A=0x07/0x87: ERIC with his arm up (as if writing on a board)
5E6C | JP $F317 | Update ERIC's animatory state and location and update the SRB