51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using System.Reflection;
|
|
using System.Reflection.PortableExecutable;
|
|
using Core;
|
|
namespace Desktop
|
|
{
|
|
public partial class Form1 : Form
|
|
{
|
|
private SmsMachine _machine = null!;
|
|
private DebuggerForm _debugger;
|
|
|
|
public ushort? Breakpoint
|
|
{
|
|
get => _machine?.Breakpoint;
|
|
set { if (_machine != null) _machine.Breakpoint = value; }
|
|
}
|
|
|
|
public Form1()
|
|
{
|
|
InitializeComponent();
|
|
_machine = new SmsMachine();
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
// 1. Load a commercial Master System ROM!
|
|
|
|
byte[] rom = File.ReadAllBytes(@"C:\Parsons\Local Code Projects\ParsonsMasterSystem2026\Desktop\ROMS\Golden Axe Warrior.sms");
|
|
|
|
|
|
try
|
|
{
|
|
|
|
// 2. Jam it into the Sega Mapper
|
|
_machine.LoadCartridge(rom);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
|
|
// 3. Open the Debugger to look around
|
|
if (_debugger == null || _debugger.IsDisposed)
|
|
{
|
|
_debugger = new DebuggerForm(_machine.Cpu, _machine.MemoryBus, this);
|
|
_debugger.Show();
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|