Added Golden Axe Warrior. Added Debugger.

This commit is contained in:
2026-05-08 22:51:30 +01:00
parent 25ac64fa5f
commit 778f03b55c
13 changed files with 2114 additions and 38 deletions

61
Core/SmsMachine.cs Normal file
View File

@@ -0,0 +1,61 @@
using Core.Cpu;
using Core.Io;
using Core.Memory;
namespace Core
{
public class SmsMachine
{
public Z80 Cpu { get; private set; }
public SmsMemoryBus MemoryBus { get; private set; }
public SmsIoBus IoBus { get; private set; }
public ushort? Breakpoint { get; set; } = null;
// NTSC SMS T-States per frame
public const int TStatesPerFrame = 59736;
public long TotalFrameCount { get; private set; } = 0;
public double FramesPerSecond { get; private set; } = 0;
public double FrameTime { get; private set; } = 0;
public SmsMachine()
{
MemoryBus = new SmsMemoryBus();
IoBus = new SmsIoBus();
Cpu = new Z80(MemoryBus, IoBus);
}
public void LoadCartridge(byte[] romData)
{
MemoryBus.LoadCartridge(romData);
Reset();
}
public void Reset()
{
MemoryBus.CleanRAMData();
Cpu.Reset();
// We will reset the VDP and PSG here later!
}
public void RunFrame()
{
long currentFrameTStates = 0;
while (currentFrameTStates < TStatesPerFrame)
{
int tStates = Cpu.Step();
currentFrameTStates += tStates;
// --- FUTURE EXPANSION ---
// VideoProcessor.Update(tStates);
// AudioProcessor.Update(tStates);
// if (VideoProcessor.IsVBlanking && VideoProcessor.InterruptsEnabled)
// {
// Cpu.RequestInterrupt();
// }
}
}
}
}