APU fully implemented and working but approx 0.25s latency to fix

This commit is contained in:
2026-05-14 22:31:23 +01:00
parent cafcf625ad
commit 780f8ee790
7 changed files with 160 additions and 18 deletions

View File

@@ -1,6 +1,8 @@
using System;
using System.Reflection.PortableExecutable;
using System.Text;
using System.Windows.Forms;
using Core.Audio;
using Core.Cpu;
using Core.Memory;
@@ -100,7 +102,7 @@ namespace Desktop
lblIY.Text = $"IY: {_cpu.IY.Word:X4}";
lblIff1.Text = $"IFF1: {_cpu.IFF1}";
lblIff2.Text = $"IFF2: {_cpu.IFF2}";
lblIE.Text = $"Interrupt Mode: {_cpu.InterruptMode}";
lblIE.Text = $"IM: {_cpu.InterruptMode}";
lblFlags.Text = $"Flags: {_cpu.GetFlagsString()}";
lblTStates.Text = $"T-States: {_cpu.TotalTStates}";
lblFrames.Text = $"Frames Rendered: {_mainForm.TotalFrameCount}";
@@ -109,11 +111,23 @@ namespace Desktop
UpdateMemoryView();
UpdateStackView();
UpdateDisassemblyView();
// --- AUDIO REGISTERS ---
// Use _mainForm to access the Machine, and then grab the AudioProcessor!
if (_mainForm._machine != null && _mainForm._machine.AudioProcessor != null)
{
ushort[] apuRegs = _mainForm._machine.AudioProcessor.Registers;
lblTone0.Text = $"Tone 0: 0x{apuRegs[0]:X4} (Vol: 0x{apuRegs[1]:X1})";
lblTone1.Text = $"Tone 1: 0x{apuRegs[2]:X4} (Vol: 0x{apuRegs[3]:X1})";
lblTone2.Text = $"Tone 2: 0x{apuRegs[4]:X4} (Vol: 0x{apuRegs[5]:X1})";
lblNoise.Text = $"Noise : 0x{apuRegs[6]:X1} (Vol: 0x{apuRegs[7]:X1})";
}
}
private void UpdateMemoryView()
{
int count = 40;
int count = 20;
// Try to parse the hex string the user typed in
if (!ushort.TryParse(txtMemoryStart.Text, System.Globalization.NumberStyles.HexNumber, null, out ushort startAddress))
{