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

414
Desktop/DebuggerForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,414 @@
namespace Desktop
{
partial class DebuggerForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
lblAF = new Label();
lblBC = new Label();
lblDE = new Label();
lblHL = new Label();
lblPC = new Label();
lblSP = new Label();
lblFlags = new Label();
lblTStates = new Label();
txtMemoryStart = new TextBox();
btnRefreshMemory = new Button();
txtMemoryView = new RichTextBox();
lstDisassembly = new ListBox();
lstStack = new ListBox();
label1 = new Label();
txtBreakpoint = new TextBox();
label2 = new Label();
lblIX = new Label();
lblIY = new Label();
lblIff1 = new Label();
lblIff2 = new Label();
lblIE = new Label();
btnReset = new Button();
uiUpdateTimer = new System.Windows.Forms.Timer(components);
lblFrames = new Label();
lblFPS = new Label();
lblFrameTime = new Label();
richTextBox1 = new RichTextBox();
button1 = new Button();
button2 = new Button();
SuspendLayout();
//
// lblAF
//
lblAF.AutoSize = true;
lblAF.Location = new Point(10, 7);
lblAF.Margin = new Padding(2, 0, 2, 0);
lblAF.Name = "lblAF";
lblAF.Size = new Size(26, 20);
lblAF.TabIndex = 0;
lblAF.Text = "AF";
//
// lblBC
//
lblBC.AutoSize = true;
lblBC.Location = new Point(9, 48);
lblBC.Margin = new Padding(2, 0, 2, 0);
lblBC.Name = "lblBC";
lblBC.Size = new Size(27, 20);
lblBC.TabIndex = 1;
lblBC.Text = "BC";
//
// lblDE
//
lblDE.AutoSize = true;
lblDE.Location = new Point(10, 100);
lblDE.Margin = new Padding(2, 0, 2, 0);
lblDE.Name = "lblDE";
lblDE.Size = new Size(28, 20);
lblDE.TabIndex = 2;
lblDE.Text = "DE";
//
// lblHL
//
lblHL.AutoSize = true;
lblHL.Location = new Point(10, 150);
lblHL.Margin = new Padding(2, 0, 2, 0);
lblHL.Name = "lblHL";
lblHL.Size = new Size(27, 20);
lblHL.TabIndex = 3;
lblHL.Text = "HL";
//
// lblPC
//
lblPC.AutoSize = true;
lblPC.Location = new Point(9, 200);
lblPC.Margin = new Padding(2, 0, 2, 0);
lblPC.Name = "lblPC";
lblPC.Size = new Size(26, 20);
lblPC.TabIndex = 4;
lblPC.Text = "PC";
//
// lblSP
//
lblSP.AutoSize = true;
lblSP.Location = new Point(9, 252);
lblSP.Margin = new Padding(2, 0, 2, 0);
lblSP.Name = "lblSP";
lblSP.Size = new Size(25, 20);
lblSP.TabIndex = 6;
lblSP.Text = "SP";
//
// lblFlags
//
lblFlags.AutoSize = true;
lblFlags.Location = new Point(88, 52);
lblFlags.Margin = new Padding(2, 0, 2, 0);
lblFlags.Name = "lblFlags";
lblFlags.Size = new Size(43, 20);
lblFlags.TabIndex = 7;
lblFlags.Text = "Flags";
//
// lblTStates
//
lblTStates.AutoSize = true;
lblTStates.Location = new Point(88, 7);
lblTStates.Margin = new Padding(2, 0, 2, 0);
lblTStates.Name = "lblTStates";
lblTStates.Size = new Size(63, 20);
lblTStates.TabIndex = 8;
lblTStates.Text = "T-States";
//
// txtMemoryStart
//
txtMemoryStart.Location = new Point(300, 21);
txtMemoryStart.Margin = new Padding(2);
txtMemoryStart.Name = "txtMemoryStart";
txtMemoryStart.Size = new Size(121, 27);
txtMemoryStart.TabIndex = 9;
txtMemoryStart.Text = "Memory Start";
txtMemoryStart.TextAlign = HorizontalAlignment.Center;
txtMemoryStart.TextChanged += btnRefreshMemory_Click;
//
// btnRefreshMemory
//
btnRefreshMemory.Location = new Point(425, 21);
btnRefreshMemory.Margin = new Padding(2);
btnRefreshMemory.Name = "btnRefreshMemory";
btnRefreshMemory.Size = new Size(90, 27);
btnRefreshMemory.TabIndex = 14;
btnRefreshMemory.Text = "Refresh Memory";
btnRefreshMemory.UseVisualStyleBackColor = true;
btnRefreshMemory.Click += btnRefreshMemory_Click;
//
// txtMemoryView
//
txtMemoryView.Location = new Point(88, 80);
txtMemoryView.Margin = new Padding(2);
txtMemoryView.Name = "txtMemoryView";
txtMemoryView.Size = new Size(443, 895);
txtMemoryView.TabIndex = 15;
txtMemoryView.Text = "Memory View Window";
//
// lstDisassembly
//
lstDisassembly.FormattingEnabled = true;
lstDisassembly.Location = new Point(567, 8);
lstDisassembly.Margin = new Padding(2);
lstDisassembly.Name = "lstDisassembly";
lstDisassembly.Size = new Size(252, 264);
lstDisassembly.TabIndex = 16;
//
// lstStack
//
lstStack.FormattingEnabled = true;
lstStack.Location = new Point(823, 8);
lstStack.Margin = new Padding(2);
lstStack.Name = "lstStack";
lstStack.Size = new Size(130, 264);
lstStack.TabIndex = 17;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(568, 298);
label1.Name = "label1";
label1.Size = new Size(81, 20);
label1.TabIndex = 19;
label1.Text = "Breakpoint";
//
// txtBreakpoint
//
txtBreakpoint.Location = new Point(655, 295);
txtBreakpoint.Name = "txtBreakpoint";
txtBreakpoint.Size = new Size(125, 27);
txtBreakpoint.TabIndex = 20;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(233, 21);
label2.Name = "label2";
label2.Size = new Size(62, 20);
label2.TabIndex = 21;
label2.Text = "Address";
//
// lblIX
//
lblIX.AutoSize = true;
lblIX.Location = new Point(9, 298);
lblIX.Margin = new Padding(2, 0, 2, 0);
lblIX.Name = "lblIX";
lblIX.Size = new Size(22, 20);
lblIX.TabIndex = 22;
lblIX.Text = "IX";
//
// lblIY
//
lblIY.AutoSize = true;
lblIY.Location = new Point(10, 344);
lblIY.Margin = new Padding(2, 0, 2, 0);
lblIY.Name = "lblIY";
lblIY.Size = new Size(21, 20);
lblIY.TabIndex = 23;
lblIY.Text = "IY";
//
// lblIff1
//
lblIff1.AutoSize = true;
lblIff1.Location = new Point(567, 411);
lblIff1.Name = "lblIff1";
lblIff1.Size = new Size(35, 20);
lblIff1.TabIndex = 24;
lblIff1.Text = "IFF1";
//
// lblIff2
//
lblIff2.AutoSize = true;
lblIff2.Location = new Point(567, 458);
lblIff2.Name = "lblIff2";
lblIff2.Size = new Size(35, 20);
lblIff2.TabIndex = 25;
lblIff2.Text = "IFF2";
//
// lblIE
//
lblIE.AutoSize = true;
lblIE.Location = new Point(568, 370);
lblIE.Name = "lblIE";
lblIE.Size = new Size(109, 20);
lblIE.TabIndex = 26;
lblIE.Text = "Interrupt Mode";
//
// btnReset
//
btnReset.Location = new Point(651, 327);
btnReset.Margin = new Padding(2);
btnReset.Name = "btnReset";
btnReset.Size = new Size(132, 27);
btnReset.TabIndex = 27;
btnReset.Text = "Set Breakpoint";
btnReset.UseVisualStyleBackColor = true;
btnReset.Click += btnSetBreakpoint_Click;
//
// uiUpdateTimer
//
uiUpdateTimer.Enabled = true;
uiUpdateTimer.Interval = 1;
uiUpdateTimer.Tick += uiUpdateTimer_Tick;
//
// lblFrames
//
lblFrames.AutoSize = true;
lblFrames.Location = new Point(567, 682);
lblFrames.Margin = new Padding(2, 0, 2, 0);
lblFrames.Name = "lblFrames";
lblFrames.Size = new Size(124, 20);
lblFrames.TabIndex = 28;
lblFrames.Text = "Frames Rendered";
//
// lblFPS
//
lblFPS.AutoSize = true;
lblFPS.Location = new Point(659, 759);
lblFPS.Margin = new Padding(2, 0, 2, 0);
lblFPS.Name = "lblFPS";
lblFPS.Size = new Size(32, 20);
lblFPS.TabIndex = 29;
lblFPS.Text = "FPS";
//
// lblFrameTime
//
lblFrameTime.AutoSize = true;
lblFrameTime.Location = new Point(604, 718);
lblFrameTime.Margin = new Padding(2, 0, 2, 0);
lblFrameTime.Name = "lblFrameTime";
lblFrameTime.Size = new Size(87, 20);
lblFrameTime.TabIndex = 30;
lblFrameTime.Text = "Frame Time";
//
// richTextBox1
//
richTextBox1.Enabled = false;
richTextBox1.Location = new Point(567, 509);
richTextBox1.Name = "richTextBox1";
richTextBox1.ReadOnly = true;
richTextBox1.Size = new Size(304, 128);
richTextBox1.TabIndex = 32;
richTextBox1.Text = "Sega Master System Memory Map:\n0x0000 - 0x3FFF: ROM Slot 0 (16KB)\n0x4000 - 0x7FFF: ROM Slot 1 (16KB)\n0x8000 - 0xBFFF: ROM Slot 2 (16KB)\n0xC000 - 0xDFFF: System RAM (8KB)\n0xE000 - 0xFFFF: RAM Mirror";
//
// button1
//
button1.Location = new Point(555, 824);
button1.Name = "button1";
button1.Size = new Size(94, 29);
button1.TabIndex = 33;
button1.Text = "CPU Step";
button1.UseVisualStyleBackColor = true;
button1.Click += btnStep_Click;
//
// button2
//
button2.Location = new Point(555, 883);
button2.Name = "button2";
button2.Size = new Size(94, 29);
button2.TabIndex = 34;
button2.Text = "CPU Run";
button2.UseVisualStyleBackColor = true;
button2.Click += btnStep_Click;
//
// DebuggerForm
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(965, 990);
Controls.Add(button2);
Controls.Add(button1);
Controls.Add(richTextBox1);
Controls.Add(lblFrameTime);
Controls.Add(lblFPS);
Controls.Add(lblFrames);
Controls.Add(btnReset);
Controls.Add(lblIE);
Controls.Add(lblIff2);
Controls.Add(lblIff1);
Controls.Add(lblIY);
Controls.Add(lblIX);
Controls.Add(label2);
Controls.Add(txtBreakpoint);
Controls.Add(label1);
Controls.Add(lstStack);
Controls.Add(lstDisassembly);
Controls.Add(txtMemoryView);
Controls.Add(btnRefreshMemory);
Controls.Add(txtMemoryStart);
Controls.Add(lblTStates);
Controls.Add(lblFlags);
Controls.Add(lblSP);
Controls.Add(lblPC);
Controls.Add(lblHL);
Controls.Add(lblDE);
Controls.Add(lblBC);
Controls.Add(lblAF);
Margin = new Padding(2);
Name = "DebuggerForm";
Text = "Debugger";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label lblAF;
private Label lblBC;
private Label lblDE;
private Label lblHL;
private Label lblPC;
private Label lblSP;
private Label lblFlags;
private Label lblTStates;
private TextBox txtMemoryStart;
private Button btnRefreshMemory;
private RichTextBox txtMemoryView;
private ListBox lstStack;
public ListBox lstDisassembly;
private Label label1;
private TextBox txtBreakpoint;
private Label label2;
private Label lblIX;
private Label lblIY;
private Label lblIff1;
private Label lblIff2;
private Label lblIE;
private Button btnReset;
private System.Windows.Forms.Timer uiUpdateTimer;
private Label lblFrames;
private Label lblFPS;
private Label lblFrameTime;
private RichTextBox richTextBox1;
private Button button1;
private Button button2;
//private TextBox textBox4;
}
}

1346
Desktop/DebuggerForm.cs Normal file

File diff suppressed because it is too large Load Diff

123
Desktop/DebuggerForm.resx Normal file
View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="uiUpdateTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -9,11 +9,21 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj" />
<None Remove="ROMS\Golden Axe Warrior.sms" />
</ItemGroup>
<ItemGroup>
<Folder Include="ROMS\" />
<EmbeddedResource Include="ROMS\Golden Axe Warrior.sms">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Vortice.XInput" Version="3.8.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj" />
</ItemGroup>
</Project>

View File

@@ -28,12 +28,33 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
button1 = new Button();
SuspendLayout();
//
// button1
//
button1.Location = new Point(304, 268);
button1.Name = "button1";
button1.Size = new Size(94, 29);
button1.TabIndex = 0;
button1.Text = "button1";
button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click;
//
// Form1
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(button1);
Name = "Form1";
Text = "Form1";
Click += button1_Click;
ResumeLayout(false);
}
#endregion
private Button button1;
}
}

View File

@@ -1,10 +1,50 @@
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();
}
}
}
}

View File

@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

Binary file not shown.