Some fixes and code refactoring

This commit is contained in:
2026-05-22 16:40:33 +01:00
parent cca1abf0be
commit b5695b5c2f
7 changed files with 233 additions and 190 deletions

View File

@@ -56,102 +56,102 @@
lblFPS = new Label();
lblFrameTime = new Label();
richTextBox1 = new RichTextBox();
button1 = new Button();
btnCpuStep = new Button();
CpuRun = new Button();
groupBox1 = new GroupBox();
lblTone0 = new Label();
lblNoise = new Label();
lblTone2 = new Label();
lblTone1 = new Label();
lblTone2 = new Label();
lblNoise = new Label();
lblTone0 = new Label();
groupBox1.SuspendLayout();
SuspendLayout();
//
// lblAF
//
lblAF.AutoSize = true;
lblAF.Location = new Point(12, 9);
lblAF.Location = new Point(10, 7);
lblAF.Margin = new Padding(2, 0, 2, 0);
lblAF.Name = "lblAF";
lblAF.Size = new Size(33, 25);
lblAF.Size = new Size(26, 20);
lblAF.TabIndex = 0;
lblAF.Text = "AF";
//
// lblBC
//
lblBC.AutoSize = true;
lblBC.Location = new Point(11, 60);
lblBC.Location = new Point(9, 48);
lblBC.Margin = new Padding(2, 0, 2, 0);
lblBC.Name = "lblBC";
lblBC.Size = new Size(33, 25);
lblBC.Size = new Size(27, 20);
lblBC.TabIndex = 1;
lblBC.Text = "BC";
//
// lblDE
//
lblDE.AutoSize = true;
lblDE.Location = new Point(12, 125);
lblDE.Location = new Point(10, 100);
lblDE.Margin = new Padding(2, 0, 2, 0);
lblDE.Name = "lblDE";
lblDE.Size = new Size(34, 25);
lblDE.Size = new Size(28, 20);
lblDE.TabIndex = 2;
lblDE.Text = "DE";
//
// lblHL
//
lblHL.AutoSize = true;
lblHL.Location = new Point(12, 188);
lblHL.Location = new Point(10, 150);
lblHL.Margin = new Padding(2, 0, 2, 0);
lblHL.Name = "lblHL";
lblHL.Size = new Size(33, 25);
lblHL.Size = new Size(27, 20);
lblHL.TabIndex = 3;
lblHL.Text = "HL";
//
// lblPC
//
lblPC.AutoSize = true;
lblPC.Location = new Point(11, 250);
lblPC.Location = new Point(9, 200);
lblPC.Margin = new Padding(2, 0, 2, 0);
lblPC.Name = "lblPC";
lblPC.Size = new Size(33, 25);
lblPC.Size = new Size(26, 20);
lblPC.TabIndex = 4;
lblPC.Text = "PC";
//
// lblSP
//
lblSP.AutoSize = true;
lblSP.Location = new Point(11, 315);
lblSP.Location = new Point(9, 252);
lblSP.Margin = new Padding(2, 0, 2, 0);
lblSP.Name = "lblSP";
lblSP.Size = new Size(32, 25);
lblSP.Size = new Size(25, 20);
lblSP.TabIndex = 6;
lblSP.Text = "SP";
//
// lblFlags
//
lblFlags.AutoSize = true;
lblFlags.Location = new Point(110, 65);
lblFlags.Location = new Point(88, 52);
lblFlags.Margin = new Padding(2, 0, 2, 0);
lblFlags.Name = "lblFlags";
lblFlags.Size = new Size(53, 25);
lblFlags.Size = new Size(43, 20);
lblFlags.TabIndex = 7;
lblFlags.Text = "Flags";
//
// lblTStates
//
lblTStates.AutoSize = true;
lblTStates.Location = new Point(110, 9);
lblTStates.Location = new Point(88, 7);
lblTStates.Margin = new Padding(2, 0, 2, 0);
lblTStates.Name = "lblTStates";
lblTStates.Size = new Size(75, 25);
lblTStates.Size = new Size(63, 20);
lblTStates.TabIndex = 8;
lblTStates.Text = "T-States";
//
// txtMemoryStart
//
txtMemoryStart.Location = new Point(375, 26);
txtMemoryStart.Location = new Point(300, 21);
txtMemoryStart.Margin = new Padding(2);
txtMemoryStart.Name = "txtMemoryStart";
txtMemoryStart.Size = new Size(150, 31);
txtMemoryStart.Size = new Size(121, 27);
txtMemoryStart.TabIndex = 9;
txtMemoryStart.Text = "Memory Start";
txtMemoryStart.TextAlign = HorizontalAlignment.Center;
@@ -159,10 +159,10 @@
//
// btnRefreshMemory
//
btnRefreshMemory.Location = new Point(531, 26);
btnRefreshMemory.Location = new Point(425, 21);
btnRefreshMemory.Margin = new Padding(2);
btnRefreshMemory.Name = "btnRefreshMemory";
btnRefreshMemory.Size = new Size(112, 34);
btnRefreshMemory.Size = new Size(90, 27);
btnRefreshMemory.TabIndex = 14;
btnRefreshMemory.Text = "Refresh Memory";
btnRefreshMemory.UseVisualStyleBackColor = true;
@@ -170,117 +170,109 @@
//
// txtMemoryView
//
txtMemoryView.Location = new Point(110, 101);
txtMemoryView.Location = new Point(88, 81);
txtMemoryView.Margin = new Padding(2);
txtMemoryView.Name = "txtMemoryView";
txtMemoryView.Size = new Size(553, 543);
txtMemoryView.Size = new Size(443, 435);
txtMemoryView.TabIndex = 15;
txtMemoryView.Text = "Memory View Window";
//
// lstDisassembly
//
lstDisassembly.FormattingEnabled = true;
lstDisassembly.ItemHeight = 25;
lstDisassembly.Location = new Point(709, 10);
lstDisassembly.Location = new Point(567, 8);
lstDisassembly.Margin = new Padding(2);
lstDisassembly.Name = "lstDisassembly";
lstDisassembly.Size = new Size(314, 329);
lstDisassembly.Size = new Size(252, 264);
lstDisassembly.TabIndex = 16;
//
// lstStack
//
lstStack.FormattingEnabled = true;
lstStack.ItemHeight = 25;
lstStack.Location = new Point(1029, 10);
lstStack.Location = new Point(823, 8);
lstStack.Margin = new Padding(2);
lstStack.Name = "lstStack";
lstStack.Size = new Size(162, 329);
lstStack.Size = new Size(130, 264);
lstStack.TabIndex = 17;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(710, 372);
label1.Margin = new Padding(4, 0, 4, 0);
label1.Location = new Point(568, 298);
label1.Name = "label1";
label1.Size = new Size(97, 25);
label1.Size = new Size(81, 20);
label1.TabIndex = 19;
label1.Text = "Breakpoint";
//
// txtBreakpoint
//
txtBreakpoint.Location = new Point(819, 369);
txtBreakpoint.Margin = new Padding(4);
txtBreakpoint.Location = new Point(655, 295);
txtBreakpoint.Name = "txtBreakpoint";
txtBreakpoint.Size = new Size(155, 31);
txtBreakpoint.Size = new Size(125, 27);
txtBreakpoint.TabIndex = 20;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(291, 26);
label2.Margin = new Padding(4, 0, 4, 0);
label2.Location = new Point(233, 21);
label2.Name = "label2";
label2.Size = new Size(77, 25);
label2.Size = new Size(62, 20);
label2.TabIndex = 21;
label2.Text = "Address";
//
// lblIX
//
lblIX.AutoSize = true;
lblIX.Location = new Point(11, 372);
lblIX.Location = new Point(9, 298);
lblIX.Margin = new Padding(2, 0, 2, 0);
lblIX.Name = "lblIX";
lblIX.Size = new Size(28, 25);
lblIX.Size = new Size(22, 20);
lblIX.TabIndex = 22;
lblIX.Text = "IX";
//
// lblIY
//
lblIY.AutoSize = true;
lblIY.Location = new Point(12, 430);
lblIY.Location = new Point(10, 344);
lblIY.Margin = new Padding(2, 0, 2, 0);
lblIY.Name = "lblIY";
lblIY.Size = new Size(27, 25);
lblIY.Size = new Size(21, 20);
lblIY.TabIndex = 23;
lblIY.Text = "IY";
//
// lblIff1
//
lblIff1.AutoSize = true;
lblIff1.Location = new Point(11, 533);
lblIff1.Margin = new Padding(4, 0, 4, 0);
lblIff1.Location = new Point(9, 426);
lblIff1.Name = "lblIff1";
lblIff1.Size = new Size(45, 25);
lblIff1.Size = new Size(35, 20);
lblIff1.TabIndex = 24;
lblIff1.Text = "IFF1";
//
// lblIff2
//
lblIff2.AutoSize = true;
lblIff2.Location = new Point(11, 586);
lblIff2.Margin = new Padding(4, 0, 4, 0);
lblIff2.Location = new Point(9, 469);
lblIff2.Name = "lblIff2";
lblIff2.Size = new Size(45, 25);
lblIff2.Size = new Size(35, 20);
lblIff2.TabIndex = 25;
lblIff2.Text = "IFF2";
//
// lblIE
//
lblIE.AutoSize = true;
lblIE.Location = new Point(11, 486);
lblIE.Margin = new Padding(4, 0, 4, 0);
lblIE.Location = new Point(9, 389);
lblIE.Name = "lblIE";
lblIE.Size = new Size(33, 25);
lblIE.Size = new Size(26, 20);
lblIE.TabIndex = 26;
lblIE.Text = "IM";
//
// btnReset
//
btnReset.Location = new Point(814, 409);
btnReset.Location = new Point(651, 327);
btnReset.Margin = new Padding(2);
btnReset.Name = "btnReset";
btnReset.Size = new Size(165, 34);
btnReset.Size = new Size(132, 27);
btnReset.TabIndex = 27;
btnReset.Text = "Set Breakpoint";
btnReset.UseVisualStyleBackColor = true;
@@ -295,61 +287,58 @@
// lblFrames
//
lblFrames.AutoSize = true;
lblFrames.Location = new Point(14, 660);
lblFrames.Location = new Point(11, 528);
lblFrames.Margin = new Padding(2, 0, 2, 0);
lblFrames.Name = "lblFrames";
lblFrames.Size = new Size(149, 25);
lblFrames.Size = new Size(124, 20);
lblFrames.TabIndex = 28;
lblFrames.Text = "Frames Rendered";
//
// lblFPS
//
lblFPS.AutoSize = true;
lblFPS.Location = new Point(129, 757);
lblFPS.Location = new Point(103, 606);
lblFPS.Margin = new Padding(2, 0, 2, 0);
lblFPS.Name = "lblFPS";
lblFPS.Size = new Size(41, 25);
lblFPS.Size = new Size(32, 20);
lblFPS.TabIndex = 29;
lblFPS.Text = "FPS";
//
// lblFrameTime
//
lblFrameTime.AutoSize = true;
lblFrameTime.Location = new Point(60, 706);
lblFrameTime.Location = new Point(48, 565);
lblFrameTime.Margin = new Padding(2, 0, 2, 0);
lblFrameTime.Name = "lblFrameTime";
lblFrameTime.Size = new Size(104, 25);
lblFrameTime.Size = new Size(87, 20);
lblFrameTime.TabIndex = 30;
lblFrameTime.Text = "Frame Time";
//
// richTextBox1
//
richTextBox1.Enabled = false;
richTextBox1.Location = new Point(682, 474);
richTextBox1.Margin = new Padding(4);
richTextBox1.Location = new Point(546, 379);
richTextBox1.Name = "richTextBox1";
richTextBox1.ReadOnly = true;
richTextBox1.Size = new Size(379, 159);
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
// btnCpuStep
//
button1.Location = new Point(1075, 756);
button1.Margin = new Padding(4);
button1.Name = "button1";
button1.Size = new Size(118, 36);
button1.TabIndex = 33;
button1.Text = "CPU Step";
button1.UseVisualStyleBackColor = true;
button1.Click += btnStep_Click;
btnCpuStep.Location = new Point(860, 605);
btnCpuStep.Name = "btnCpuStep";
btnCpuStep.Size = new Size(94, 29);
btnCpuStep.TabIndex = 33;
btnCpuStep.Text = "CPU Step";
btnCpuStep.UseVisualStyleBackColor = true;
btnCpuStep.Click += btnStep_Click;
//
// CpuRun
//
CpuRun.Location = new Point(943, 757);
CpuRun.Margin = new Padding(4);
CpuRun.Location = new Point(754, 606);
CpuRun.Name = "CpuRun";
CpuRun.Size = new Size(118, 36);
CpuRun.Size = new Size(94, 29);
CpuRun.TabIndex = 34;
CpuRun.Text = "CPU Run";
CpuRun.UseVisualStyleBackColor = true;
@@ -361,57 +350,63 @@
groupBox1.Controls.Add(lblTone2);
groupBox1.Controls.Add(lblNoise);
groupBox1.Controls.Add(lblTone0);
groupBox1.Location = new Point(266, 658);
groupBox1.Location = new Point(213, 526);
groupBox1.Margin = new Padding(2, 2, 2, 2);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(397, 222);
groupBox1.Padding = new Padding(2, 2, 2, 2);
groupBox1.Size = new Size(318, 178);
groupBox1.TabIndex = 35;
groupBox1.TabStop = false;
groupBox1.Text = "Audio (SN76489)";
//
// lblTone0
// lblTone1
//
lblTone0.AutoSize = true;
lblTone0.Location = new Point(25, 48);
lblTone0.Name = "lblTone0";
lblTone0.Size = new Size(59, 25);
lblTone0.TabIndex = 0;
lblTone0.Text = "Tone0";
//
// lblNoise
//
lblNoise.AutoSize = true;
lblNoise.Location = new Point(25, 160);
lblNoise.Name = "lblNoise";
lblNoise.Size = new Size(57, 25);
lblNoise.TabIndex = 1;
lblNoise.Text = "Noise";
lblTone1.AutoSize = true;
lblTone1.Location = new Point(20, 66);
lblTone1.Margin = new Padding(2, 0, 2, 0);
lblTone1.Name = "lblTone1";
lblTone1.Size = new Size(49, 20);
lblTone1.TabIndex = 3;
lblTone1.Text = "Tone1";
//
// lblTone2
//
lblTone2.AutoSize = true;
lblTone2.Location = new Point(25, 122);
lblTone2.Location = new Point(20, 98);
lblTone2.Margin = new Padding(2, 0, 2, 0);
lblTone2.Name = "lblTone2";
lblTone2.Size = new Size(59, 25);
lblTone2.Size = new Size(49, 20);
lblTone2.TabIndex = 2;
lblTone2.Text = "Tone2";
//
// lblTone1
// lblNoise
//
lblTone1.AutoSize = true;
lblTone1.Location = new Point(25, 83);
lblTone1.Name = "lblTone1";
lblTone1.Size = new Size(59, 25);
lblTone1.TabIndex = 3;
lblTone1.Text = "Tone1";
lblNoise.AutoSize = true;
lblNoise.Location = new Point(20, 128);
lblNoise.Margin = new Padding(2, 0, 2, 0);
lblNoise.Name = "lblNoise";
lblNoise.Size = new Size(47, 20);
lblNoise.TabIndex = 1;
lblNoise.Text = "Noise";
//
// lblTone0
//
lblTone0.AutoSize = true;
lblTone0.Location = new Point(20, 38);
lblTone0.Margin = new Padding(2, 0, 2, 0);
lblTone0.Name = "lblTone0";
lblTone0.Size = new Size(49, 20);
lblTone0.TabIndex = 0;
lblTone0.Text = "Tone0";
//
// DebuggerForm
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1206, 892);
ClientSize = new Size(965, 714);
Controls.Add(groupBox1);
Controls.Add(CpuRun);
Controls.Add(button1);
Controls.Add(btnCpuStep);
Controls.Add(richTextBox1);
Controls.Add(lblFrameTime);
Controls.Add(lblFPS);
@@ -475,7 +470,7 @@
private Label lblFPS;
private Label lblFrameTime;
private RichTextBox richTextBox1;
private Button button1;
private Button btnCpuStep;
private Button CpuRun;
public System.Windows.Forms.Timer uiUpdateTimer;
private GroupBox groupBox1;