Some minor changes and playing about

This commit is contained in:
2026-04-16 14:40:05 +01:00
parent 92625498bf
commit 968141056b
9 changed files with 135 additions and 46 deletions

View File

@@ -53,7 +53,7 @@ namespace Desktop
private async void btnRun_Click(object sender, EventArgs e)
{
// If it is already running, this button acts as a STOP button
//Stops
if (_isRunning)
{
_isRunning = false;
@@ -61,7 +61,7 @@ namespace Desktop
return;
}
// --- NEW: Parse the Breakpoint ---
//Parse the Breakpoint
if (!string.IsNullOrWhiteSpace(txtBreakpoint.Text))
{
if (ushort.TryParse(txtBreakpoint.Text, System.Globalization.NumberStyles.HexNumber, null, out ushort parsedBp))
@@ -76,18 +76,14 @@ namespace Desktop
}
else
{
_breakpoint = null; // No text means no breakpoint
_breakpoint = null;
}
// ---------------------------------
// Start the run state
_isRunning = true;
btnRun.Text = "Stop";
// Fire up a background thread
// Fire up a background thread
//Background thread
await Task.Run(() =>
{
try
@@ -111,6 +107,13 @@ namespace Desktop
// --- Execute Instruction ---
_cpu.Step();
//if (_cpu.TotalTStates % 1000 == 0)
//{
// this.Invoke((MethodInvoker)delegate
// {
// UpdateDisplay();
// });
//}
// --- Check for End of Frame ---
if (_cpu.TotalTStates >= nextFrameTargetTStates)
@@ -164,8 +167,7 @@ namespace Desktop
}
});
// Whether it stopped because of a breakpoint, a crash, or the user clicking "Stop",
// we MUST update the UI when the background thread finishes!
//update the UI when the background thread finishes
btnRun.Text = "Run";
UpdateDisplay();
}