ULA Implemented. Scanline renderer so cycle accurate

This commit is contained in:
2026-04-21 15:34:10 +01:00
parent ad3a0b5040
commit dcbb505145
6 changed files with 424 additions and 310 deletions

View File

@@ -11,8 +11,6 @@ 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, Form1 mainForm)
{
@@ -61,15 +59,12 @@ namespace Desktop
private void uiUpdateTimer_Tick(object sender, EventArgs e)
{
// Every 100ms, take a snapshot of the CPU state and draw it to the screen.
// This makes the registers look like they are spinning matrix-style while running!
UpdateDisplay();
}
// This is the master function that pulls state from the CPU
// Current Emulator State
private void UpdateDisplay()
{
// 1. Update Registers (Formatting as 4-character Hex strings)
lblAF.Text = $"AF: {_cpu.AF.Word:X4}";
lblBC.Text = $"BC: {_cpu.BC.Word:X4}";
lblDE.Text = $"DE: {_cpu.DE.Word:X4}";
@@ -81,12 +76,11 @@ namespace Desktop
lblIff1.Text = $"IFF1: {_cpu.IFF1}";
lblIff2.Text = $"IFF2: {_cpu.IFF2}";
lblIE.Text = $"Interrupt Mode: {_cpu.InterruptMode}";
// 2. Update Flags & T-States
lblFlags.Text = $"Flags: {_cpu.GetFlagsString()}";
lblTStates.Text = $"T-States: {_cpu.TotalTStates}";
// 3. Update Memory Viewer
lblFrames.Text = $"Frames Rendered: {_mainForm.TotalFrameCount}";
lblFrameTime.Text = $"Frame Time: {((float)_mainForm.FrameTime):F1}ms";
lblFPS.Text = $"FPS: {_mainForm.FramesPerSecond:F2}";
UpdateMemoryView();
UpdateStackView();
UpdateDisassemblyView();