Skip to content

Commit c86c2eb

Browse files
committed
Experimental fix for IF1 break problem.
1 parent fe5c813 commit c86c2eb

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

src/io.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ struct hostent *he;
2626
char host_name[32];
2727
#endif
2828

29+
extern unsigned char keyboard_break_pressed; // IF1 Break protection
2930

3031
char io_initialized=0;
3132
extern unsigned char is_extend; //bring in is_extend for borders
@@ -83,27 +84,32 @@ void io_main(void)
8384
{
8485
#ifdef __RS232__
8586

86-
//Don't try to wrap this in for Rasta bars, it just flashes every call to io_main.
87+
//Don't try to wrap this in for Rasta bars, it just flashes every call to io_main.
88+
89+
if (keyboard_break_pressed)
90+
goto io_do_rx_only; // This has to be short circuited because of the extra keyboard scanning needed.
91+
8792
if (rs232_get(&inb) != RS_ERR_NO_DATA) // *IRQ-OFF (RECEIVING DATA)
8893
{ /* [RX - Display] */
8994
#ifdef __SPECTRUM__
90-
if(is_extend==1) {zx_border(INK_BLACK);} else {zx_border(INK_WHITE);} //RS232 Raster Bars- A little lie, the IO has been done.
95+
if(is_extend==1) {zx_border(INK_BLACK);} else {zx_border(INK_WHITE);} //RS232 Raster Bars- A little lie, the IO has been done.
9196
#endif
92-
ShowPLATO(&inb,1);
97+
ShowPLATO(&inb,1);
9398
#ifdef __SPECTRUM__
94-
if(is_extend==1) {zx_border(INK_GREEN);} else {zx_border(INK_BLACK);} //RS232 Raster Bars
99+
if(is_extend==1) {zx_border(INK_GREEN);} else {zx_border(INK_BLACK);} //RS232 Raster Bars
95100
#endif
96101
}
97102
else
98103
{ /* [NO RX - KEY scan] */
99104
#ifdef __SPECTRUM__
100-
if(is_extend==1) {zx_border(INK_GREEN);} else {zx_border(INK_BLACK);} //RS232 Raster Bars
105+
io_do_rx_only:
106+
if(is_extend==1) {zx_border(INK_GREEN);} else {zx_border(INK_BLACK);} //RS232 Raster Bars
101107
#endif
102-
for(int Kscan=0;Kscan<30;Kscan++) //Extra keyboard scanning
103-
{
104-
keyboard_main();
105-
}
106-
108+
for(int Kscan=0;Kscan<30;Kscan++) //Extra keyboard scanning
109+
{
110+
keyboard_main();
111+
}
112+
107113
}
108114
#endif
109115
#ifdef __SPECTRANET__

src/keyboard.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ extern padBool TTY;
2525
static unsigned char ch;
2626
unsigned char is_extend=0; //deleted static is used in IO.C now for Rasta bars
2727

28+
// input.h internal state - for trapping verboten keys
29+
uchar in_KeyDebounce;
30+
uchar in_KeyStartRepeat;
31+
uchar in_KeyRepeatPeriod;
32+
uchar in_KbdState;
33+
uchar keyboard_break_pressed=false;
34+
2835
/**
2936
* A simple key press feedback.
3037
*/
@@ -74,6 +81,13 @@ void keyboard_out_tty(char ch)
7481
*/
7582
void keyboard_main(void)
7683
{
84+
// This snippet looks for break keyboard press, and sets a flag so that I/O doesn't call rs232_get when pressed, to
85+
// avoid tripping over the ZX Interface 1's "break" functionality.
86+
in_GetKeyReset();
87+
keyboard_break_pressed=false;
88+
if (in_KeyPressed==0x817F) // Look for BREAK key combination
89+
keyboard_break_pressed=true;
90+
7791
ch=getk();
7892
if (ch!=0x00)
7993
{

0 commit comments

Comments
 (0)