Prev: $17E5 Up: Map Next: $189D
$184E: Deal with ERIC when he's writing on a blackboard
This corresponds to $F6AA in the ZX Spectrum version.
Used by the routine at $15B3.
$184E DEC $FE Decrement ERIC's action timer at $FE (which is reset to $0A by the routine at $19A5 when ERIC starts writing on the blackboard and each time he writes a character on it) and pick up the new value.
$1850 LDA $FE
$1852 CMP #$04 Is it 4 now?
$1854 BNE $1859 Branch if not.
$1856 JMP $1928 Lower ERIC's arm.
$1859 CMP #$00 Is ERIC's action timer zero now?
$185B BEQ $1860 Branch if so.
$185D JMP $189C Otherwise return.
$1860 LDA #$01 Reset ERIC's action timer at $FE to 1.
$1862 STA $FE
$1864 LDA $4C Pick up the keyboard/joystick reading from $4C and copy it to $57.
$1866 STA $57
$1868 LDA #$00 Clear the keyboard/joystick reading at $4C.
$186A STA $4C
$186C LDA $57 Pick up the keyboard/joystick reading from $57.
$186E BEQ $189C Return if no key was pressed.
$1870 CMP #$0D Was RETURN pressed?
$1872 BNE $1877 Branch if not.
$1874 JMP $191F Make ERIC stop writing on the blackboard.
$1877 CMP #$20 Is the character code of the keypress less than $20?
$1879 BCC $189C Return if so.
$187B CMP #$80 Is the character code of the keypress $80 or more?
$187D BCS $189C Return if so.
$187F JSR $1468 Get the identifier and coordinates of the blackboard closest to ERIC and copy its buffer into page 0.
$1882 LDX #$03 Prepare X to check the last byte of the blackboard's buffer.
$1884 LDA $DF,X Pick up one of the last four bytes of the blackboard's buffer from $DF-$E2.
$1886 CMP #$80 Is a character code stored here?
$1888 BNE $1891 Branch if so to check the previous byte.
$188A LDA $57 Otherwise store the character code of the last keypress at this location in the blackboard's buffer.
$188C STA $DF,X
$188E JMP $1894 Jump forward.
$1891 DEX Move to the previous byte in the blackboard's buffer.
$1892 BPL $1884 Branch back to check the character code there.
$1894 LDA $57 Pick up the keyboard/joystick reading from $57.
$1896 JSR $11CF Write the corresponding character on the blackboard.
$1899 JMP $19F5 Raise ERIC's arm.
$189C RTS
Prev: $17E5 Up: Map Next: $189D