Interrupts added at 50fps. Dummy keyboard. Ready for graphics!
This commit is contained in:
@@ -10,20 +10,23 @@ namespace Desktop
|
||||
{
|
||||
private readonly Z80 _cpu;
|
||||
private readonly MemoryBus _memoryBus;
|
||||
private readonly Form1 _mainForm;
|
||||
private bool _isRunning = false;
|
||||
private ushort? _breakpoint = null;
|
||||
|
||||
public DebuggerForm(Z80 cpu, MemoryBus memoryBus)
|
||||
public DebuggerForm(Z80 cpu, MemoryBus memoryBus, Form1 mainForm)
|
||||
{
|
||||
InitializeComponent();
|
||||
_cpu = cpu;
|
||||
_memoryBus = memoryBus;
|
||||
_mainForm = mainForm;
|
||||
|
||||
// Set default memory view address
|
||||
txtMemoryStart.Text = "0000";
|
||||
UpdateDisplay();
|
||||
UpdateStackView();
|
||||
UpdateDisassemblyView();
|
||||
_mainForm = mainForm;
|
||||
}
|
||||
|
||||
private void btnStep_Click(object sender, EventArgs e)
|
||||
@@ -119,8 +122,14 @@ namespace Desktop
|
||||
nextFrameTargetTStates += TStatesPerFrame;
|
||||
frameCount++;
|
||||
|
||||
// 3. Throttle to real-time (50 frames per second = 20ms per frame)
|
||||
long targetTimeMs = frameCount * 20;
|
||||
//3 Render the screen
|
||||
_mainForm.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
_mainForm.RenderScreen();
|
||||
});
|
||||
|
||||
// 4. Throttle to real-time (50 frames per second = 20ms per frame)
|
||||
long targetTimeMs = frameCount * 20;
|
||||
long elapsedMs = stopwatch.ElapsedMilliseconds;
|
||||
|
||||
if (elapsedMs < targetTimeMs)
|
||||
@@ -131,7 +140,7 @@ namespace Desktop
|
||||
|
||||
// Optional: Update the UI every 10 frames so you can watch it run safely
|
||||
// without overwhelming the WinForms rendering engine.
|
||||
if (frameCount % 10 == 0)
|
||||
if (frameCount % 1 == 0)
|
||||
{
|
||||
this.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user