Prev: ECDE Up: Map Next: ECFB
ECE6: Check BREAK Key
Used by the routines at EBC8, ED10 and F4EC.
Checks whether the BREAK key combination (CAPS SHIFT + SPACE) is held while *FFFF equals 63. Called during the attract mode loop and option screens. If both conditions are met, the ROM error handler is invoked via RST 08 (parameter 14), which jumps via ERRSP (5C3D) to reset the machine.
CheckBreakKey ECE6 LD A,($FFFF) Return if *FFFF is not equal to 63.
ECE9 CP $63
ECEB RET NZ
Read both halves of the BREAK key combination. Keyboard bits are active-low (00 when pressed); OR-ing the two readings and masking to bit 0 gives 00 only when both keys are held simultaneously.
ECEC LD BC,$FEFE Read from the keyboard;
Port Number Bit
0 1 2 3 4
FE CAPS SHIFT Z X C V
ECEF IN E,(C)
ECF1 LD B,$7F Read from the keyboard;
Port Number Bit
0 1 2 3 4
7F SPACE FULL-STOP M N B
ECF3 IN A,(C)
ECF5 OR E OR with the CAPS SHIFT reading; bit 0 is 00 only if both are pressed.
ECF6 AND %00000001 Keep only bit 0.
ECF8 RET NZ Return if CAPS SHIFT and SPACE are not both held (BREAK not detected).
Both conditions confirmed; trigger the ROM error handler which jumps via ERRSP (5C3D) to reset the machine.
ECF9 RST $08 Run the ERROR_1 routine: RST 08.
ECFA DEFB $14 Error code: 14 ("BREAK into program").
Prev: ECDE Up: Map Next: ECFB