Can somewhat load from audio

This commit is contained in:
2026-04-28 20:09:03 +01:00
parent 38bef38f96
commit ae685eabd6
7 changed files with 127 additions and 105 deletions

View File

@@ -118,10 +118,10 @@ namespace Desktop
long tStatesBefore = _cpu.TotalTStates;
// --- HARDWARE INTERCEPTS ---
if (_cpu.PC == 0x0556 && _tapManager.HasBlocks)
if ((_cpu.PC == 0x0556 || _cpu.PC == 0x0558) && _tapManager.HasBlocks)
{
HandleInstantTapeLoad();
_cpu.TotalTStates += 100; // Charge some arbitrary time for the fast load
HandleInstantTapeLoad();
_cpu.TotalTStates += 100; // Charge some arbitrary time for the fast load
}
// --- Execute Instruction ---
@@ -130,7 +130,7 @@ namespace Desktop
int elapsedTStates = (int)(_cpu.TotalTStates - tStatesBefore);
_tapManager.Update(elapsedTStates);
if(highSpeed)
if (highSpeed)
{
wasHighSpeed = true;
}
@@ -186,7 +186,7 @@ namespace Desktop
this.Text = $"{_baseTitle} - FPS: {FramesPerSecond:F1} - Tape Loaded: {tapeLoaded.ToString()}";
});
}
}
else
{
@@ -219,7 +219,7 @@ namespace Desktop
FrameTime = TotalFrameTime / 50.0;
TotalFrameTime = 0;
}
fpsStopwatch.Restart();
}
}
@@ -231,7 +231,7 @@ namespace Desktop
this.Invoke((System.Windows.Forms.MethodInvoker)delegate
{
MessageBox.Show(ex.Message, "CPU Crash", MessageBoxButtons.OK, MessageBoxIcon.Error);
});
}
});
@@ -357,6 +357,7 @@ namespace Desktop
// Feed it directly to your existing TapManager!
_tapManager.LoadTapData(tapBytes);
tapeLoaded = true;
_tapManager.Play();
}
}
}
@@ -487,12 +488,13 @@ namespace Desktop
byte[] tapBytes = File.ReadAllBytes(ofd.FileName);
_tapManager.LoadTapData(tapBytes);
tapeLoaded = true;
_tapManager.Play();
}
}
_isPaused = false;
}
private void openSNAToolStripMenuItem_Click(object sender, EventArgs e)
{
_isPaused = true;
@@ -544,7 +546,7 @@ namespace Desktop
_debugger.BringToFront();
}
}
private void UpdateMatrix(int row, int col, bool isPressed)
{
if (isPressed)
@@ -559,14 +561,14 @@ namespace Desktop
}
}
protected override void OnKeyDown(KeyEventArgs e)
{
HandleKey(e.KeyCode, true);
base.OnKeyDown(e);
}
protected override void OnKeyUp(KeyEventArgs e)
{
HandleKey(e.KeyCode, false);
@@ -634,5 +636,20 @@ namespace Desktop
case Keys.B: UpdateMatrix(7, 4, isPressed); break;
}
}
private void playTapeToolStripMenuItem_Click(object sender, EventArgs e)
{
if (playTapeToolStripMenuItem.Text == "Play Tape")
{
playTapeToolStripMenuItem.Text = "Stop Tape";
_tapManager.Play();
}
else
{
playTapeToolStripMenuItem.Text = "Play Tape";
_tapManager.Stop();
}
}
}
}