diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj
index c7980570df..b0d1805c42 100644
--- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj
+++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj
@@ -653,6 +653,10 @@
GenericDebugger.cs
+
+ GenericDebugger.cs
+ Form
+
GenericDebugger.cs
Form
diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Disassembler.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Disassembler.cs
new file mode 100644
index 0000000000..8b42c526bc
--- /dev/null
+++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Disassembler.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace BizHawk.Client.EmuHawk
+{
+ public partial class GenericDebugger
+ {
+ private class DisasmOp
+ {
+ public DisasmOp(int s, string m)
+ {
+ Size = s;
+ Mnemonic = m;
+ }
+
+ public int Size { get; private set; }
+ public string Mnemonic { get; private set; }
+ }
+
+ private const int ADDR_MAX = 0xFFFF; // TODO: this isn't a constant, calculate it off bus size
+ private const int DISASM_LINE_COUNT = 100;
+
+ private readonly List DisassemblyLines = new List();
+
+ private void UpdateDisassembler()
+ {
+ // Always show a window's worth of instructions (if possible)
+ if (CanDisassemble)
+ {
+ DisassemblerView.BlazingFast = true;
+ Disassemble(DISASM_LINE_COUNT);
+ DisassemblerView.ensureVisible(0xFFFF);
+ DisassemblerView.ensureVisible(PC);
+ DisassemblerView.Refresh();
+ DisassemblerView.BlazingFast = false;
+ }
+ }
+
+ private void Disassemble(int line_count)
+ {
+ DisassemblyLines.Clear();
+ int a = PC;
+ for (int i = 0; i < line_count; ++i)
+ {
+ int advance;
+ string line = Disassembler.Disassemble(MemoryDomains.SystemBus, (ushort)a, out advance);
+ DisassemblyLines.Add(new DisasmOp(advance, line));
+ a += advance;
+ if (a > ADDR_MAX)
+ {
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs
index c54bd03e5f..280a92c6d0 100644
--- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs
+++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs
@@ -54,18 +54,18 @@ namespace BizHawk.Client.EmuHawk
text = "";
if (column == 0)
{
- if (addr <= index && index < addr + lines.Count)
+ if (PC <= index && index < PC + DisassemblyLines.Count)
{
- int a = addr;
- for (int i = 0; i < index - addr; ++i)
- a += lines[i].size;
+ int a = PC;
+ for (int i = 0; i < index - PC; ++i)
+ a += DisassemblyLines[i].Size;
text = string.Format("{0:X4}", a);
}
}
else if (column == 1)
{
- if (addr <= index && index < addr + lines.Count)
- text = lines[index - addr].mnemonic;
+ if (PC <= index && index < PC + DisassemblyLines.Count)
+ text = DisassemblyLines[index - PC].Mnemonic;
}
}
@@ -203,54 +203,6 @@ namespace BizHawk.Client.EmuHawk
Owner = Global.Config.RamSearchSettings.FloatingWindow ? null : GlobalWin.MainForm;
}
- #region Disassembler TODO refacotor
-
- private readonly List lines = new List();
-
- private struct DisasmOp
- {
- public readonly int size;
- public readonly string mnemonic;
- public DisasmOp(int s, string m) { size = s; mnemonic = m; }
- }
-
- private int addr;
- private const int ADDR_MAX = 0xFFFF; // TODO: this isn't a constant, calculate it off bus size
- private const int DISASM_LINE_COUNT = 100;
-
- private void UpdateDisassembler()
- {
- // Always show a window's worth of instructions (if possible)
- if (CanDisassemble)
- {
- addr = PC;
-
- DisassemblerView.BlazingFast = true;
- Disasm(DISASM_LINE_COUNT);
- DisassemblerView.ensureVisible(0xFFFF);
- DisassemblerView.ensureVisible(PC);
-
- DisassemblerView.Refresh();
- DisassemblerView.BlazingFast = false;
- }
- }
-
- private void Disasm(int line_count)
- {
- lines.Clear();
- int a = addr;
- for (int i = 0; i < line_count; ++i)
- {
- int advance;
- string line = Disassembler.Disassemble(MemoryDomains.SystemBus, (ushort)a, out advance);
- lines.Add(new DisasmOp(advance, line));
- a += advance;
- if (a > ADDR_MAX) break;
- }
- }
-
- #endregion
-
#region Menu Items
#region File