summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2026-06-14 21:13:39 +0100
committerIan C <ianc@noddybox.co.uk>2026-06-14 21:13:39 +0100
commitf540fb7da37d6c5b5544715e4ee6b83d440ea61d (patch)
treebd2862cb9e1eafe349340d30fce2036dd5032f0f
parent8f4656b7920d37b3f1df5944dfe9307264a52f0b (diff)
Fixed bug where load dialog is opened as part of the save patch
-rw-r--r--src/spec.c38
1 files changed, 34 insertions, 4 deletions
diff --git a/src/spec.c b/src/spec.c
index 3a872dd..2ddf661 100644
--- a/src/spec.c
+++ b/src/spec.c
@@ -53,8 +53,8 @@ static const int ROMLEN=0x4000;
static const int ROM_SAVE=0x4c6;
static const int ROM_LOAD=0x562;
-static int selected_in_tape = FALSE;
-static int selected_out_tape = FALSE;
+static int selected_in_tape = 0;
+static int selected_out_tape = 0;
#define LOAD_PATCH 0xf0
#define SAVE_PATCH 0xf1
@@ -241,6 +241,16 @@ static void DumpZ80(Z80 *z80)
/* ---------------------------------------- PRIVATE FUNCTIONS
*/
+static void ClearKeys(void)
+{
+ int f;
+
+ for(f = 0; f < 8; f++)
+ {
+ matrix[f] = 0xff;
+ }
+}
+
static void DrawScanlineAt(int y, int sline)
{
int aline;
@@ -353,8 +363,13 @@ static int EDCallback(Z80 *z80, Z80Val data)
if (!TAPEFile(TAP_OUT) && !selected_out_tape)
{
+ /* Clear the keys as otherwise the ENTER up is consumed
+ by the GUI and the Spectrum thinks the ENTER key is being
+ held down.
+ */
+ ClearKeys();
TAPESelectOutput();
- selected_out_tape = TRUE;
+ selected_out_tape = 50;
}
if (!TAPEFile(TAP_OUT))
@@ -386,8 +401,13 @@ static int EDCallback(Z80 *z80, Z80Val data)
if (!TAPEFile(TAP_IN) && !selected_in_tape)
{
+ /* Clear the keys as otherwise the ENTER up is consumed
+ by the GUI and the Spectrum thinks the ENTER key is being
+ held down.
+ */
+ ClearKeys();
TAPESelectInput();
- selected_in_tape = TRUE;
+ selected_in_tape = 50;
}
if (!TAPEFile(TAP_IN))
@@ -455,6 +475,16 @@ static int CheckTimers(Z80 *z80, Z80Val val)
GFXEndFrame(TRUE);
GFXStartFrame();
}
+
+ if (selected_in_tape > 0)
+ {
+ selected_in_tape--;
+ }
+
+ if (selected_out_tape > 0)
+ {
+ selected_out_tape--;
+ }
}
/* Draw scanline