Prev: 60638 Up: Map Next: 60667
60646: Check BREAK Key
Used by the routines at 60360, 60688 and 62700.
Checks whether the BREAK key combination (CAPS SHIFT + SPACE) is held while *65535 equals 99. Called during the attract mode loop and option screens. If both conditions are met, the ROM error handler is invoked via RST 8 (parameter 20), which jumps via ERRSP (23613) to reset the machine.
CheckBreakKey 60646 LD A,(65535) Return if *65535 is not equal to 99.
60649 CP 99
60651 RET NZ
Read both halves of the BREAK key combination. Keyboard bits are active-low (0 when pressed); OR-ing the two readings and masking to bit 0 gives 0 only when both keys are held simultaneously.
60652 LD BC,65278 Read from the keyboard;
Port Number Bit
0 1 2 3 4
254 CAPS SHIFT Z X C V
60655 IN E,(C)
60657 LD B,127 Read from the keyboard;
Port Number Bit
0 1 2 3 4
127 SPACE FULL-STOP M N B
60659 IN A,(C)
60661 OR E OR with the CAPS SHIFT reading; bit 0 is 0 only if both are pressed.
60662 AND %00000001 Keep only bit 0.
60664 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 (23613) to reset the machine.
60665 RST 8 Run the ERROR_1 routine: RST 8.
60666 DEFB 20 Error code: 20 ("BREAK into program").
Prev: 60638 Up: Map Next: 60667