From 4bdbf9fa149320e884a2b5af220a59dfb04646f2 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 20 Dec 2014 18:11:42 +0000 Subject: [PATCH] Debugger - Disassembler - use the System Bus to assess the max value, instead of a hardcoded 0xFFFF --- .../Debugger/GenericDebugger.Disassembler.cs | 15 ++++++++++++--- .../tools/Debugger/GenericDebugger.cs | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Disassembler.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Disassembler.cs index 887d9702ee..5e518c72a8 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Disassembler.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.Disassembler.cs @@ -20,7 +20,16 @@ namespace BizHawk.Client.EmuHawk 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 ADDR_MAX = 0xFFFF; // TODO: this isn't a constant, calculate it off bus size + + private int BusMaxValue + { + get + { + return MemoryDomains.SystemBus.Size; + } + } + private const int DISASM_LINE_COUNT = 100; private readonly List DisassemblyLines = new List(); @@ -32,7 +41,7 @@ namespace BizHawk.Client.EmuHawk { DisassemblerView.BlazingFast = true; Disassemble(DISASM_LINE_COUNT); - DisassemblerView.ensureVisible(0xFFFF); + DisassemblerView.ensureVisible(BusMaxValue); DisassemblerView.ensureVisible(PC); DisassemblerView.Refresh(); DisassemblerView.BlazingFast = false; @@ -49,7 +58,7 @@ namespace BizHawk.Client.EmuHawk string line = Disassembler.Disassemble(MemoryDomains.SystemBus, (ushort)a, out advance); DisassemblyLines.Add(new DisasmOp(advance, line)); a += advance; - if (a > ADDR_MAX) + if (a > BusMaxValue) { break; } diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs index c3377bf687..d5b169aca0 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs @@ -28,11 +28,12 @@ namespace BizHawk.Client.EmuHawk DisassemblerView.QueryItemText += DisassemblerView_QueryItemText; DisassemblerView.QueryItemBkColor += DisassemblerView_QueryItemBkColor; DisassemblerView.VirtualMode = true; - DisassemblerView.ItemCount = ADDR_MAX + 1; } private void GenericDebugger_Load(object sender, EventArgs e) { + DisassemblerView.ItemCount = BusMaxValue + 1; + _defaultWidth = Size.Width; _defaultHeight = Size.Height;