From 2e8a13e9201d13ac5960b38ade8d7f3b4a6d517f Mon Sep 17 00:00:00 2001 From: Sour Date: Sun, 23 Feb 2020 21:50:55 -0500 Subject: [PATCH] Debugger: Added DSP debugger --- Core/Console.cpp | 9 +- Core/Console.h | 1 - Core/Core.vcxproj | 2 + Core/Core.vcxproj.filters | 6 + Core/DebugTypes.h | 1 + Core/DebugUtilities.h | 2 +- Core/Debugger.cpp | 43 +- Core/Debugger.h | 3 +- Core/Disassembler.cpp | 53 +- Core/Disassembler.h | 1 + Core/DisassemblyInfo.cpp | 6 +- Core/Gsu.cpp | 5 + Core/Gsu.h | 1 + Core/LabelManager.cpp | 2 + Core/MemoryDumper.cpp | 4 +- Core/NecDsp.cpp | 44 +- Core/NecDsp.h | 9 +- Core/NecDspDebugger.cpp | 101 +++ Core/NecDspDebugger.h | 40 ++ Core/NecDspDisUtils.cpp | 13 +- Core/Sa1.cpp | 5 + Core/Sa1.h | 1 + Core/SettingTypes.h | 1 + UI/Debugger/Breakpoints/Breakpoint.cs | 2 + UI/Debugger/Breakpoints/ctrlBreakpoints.cs | 3 +- .../Breakpoints/frmBreakpoint.Designer.cs | 4 +- UI/Debugger/Breakpoints/frmBreakpoint.cs | 4 + UI/Debugger/Code/CodeHighlighting.cs | 2 +- UI/Debugger/Code/NecDspDisassemblyManager.cs | 29 + UI/Debugger/Code/NecDspLineStyleProvider.cs | 64 ++ UI/Debugger/Config/DebuggerShortcutsConfig.cs | 2 + UI/Debugger/Controls/ctrlDisassemblyView.cs | 2 + .../Controls/ctrlNecDspStatus.Designer.cs | 646 ++++++++++++++++++ UI/Debugger/Controls/ctrlNecDspStatus.cs | 57 ++ UI/Debugger/Controls/ctrlNecDspStatus.resx | 120 ++++ UI/Debugger/Controls/ctrlSpcStatus.cs | 10 +- UI/Debugger/DebugWindowManager.cs | 5 + UI/Debugger/Labels/CodeLabel.cs | 2 + UI/Debugger/Labels/LabelManager.cs | 3 + UI/Debugger/Labels/ctrlLabelList.cs | 17 +- UI/Debugger/Labels/frmEditLabel.cs | 2 + UI/Debugger/Workspace/DebugWorkspace.cs | 2 + .../Workspace/DebugWorkspaceManager.cs | 8 + UI/Debugger/frmDbgPreferences.cs | 1 + UI/Debugger/frmDebugger.Designer.cs | 298 ++++---- UI/Debugger/frmDebugger.cs | 87 ++- UI/Forms/frmMain.Designer.cs | 54 +- UI/Forms/frmMain.cs | 15 + UI/Interop/ConfigApi.cs | 1 + UI/Interop/DebugApi.cs | 6 +- UI/Properties/Resources.Designer.cs | 10 + UI/Properties/Resources.resx | 3 + UI/Resources/NecDspDebugger.png | Bin 0 -> 691 bytes UI/UI.csproj | 12 + 54 files changed, 1550 insertions(+), 274 deletions(-) create mode 100644 Core/NecDspDebugger.cpp create mode 100644 Core/NecDspDebugger.h create mode 100644 UI/Debugger/Code/NecDspDisassemblyManager.cs create mode 100644 UI/Debugger/Code/NecDspLineStyleProvider.cs create mode 100644 UI/Debugger/Controls/ctrlNecDspStatus.Designer.cs create mode 100644 UI/Debugger/Controls/ctrlNecDspStatus.cs create mode 100644 UI/Debugger/Controls/ctrlNecDspStatus.resx create mode 100644 UI/Resources/NecDspDebugger.png diff --git a/Core/Console.cpp b/Core/Console.cpp index 0285de4..8f43ea5 100644 --- a/Core/Console.cpp +++ b/Core/Console.cpp @@ -840,13 +840,6 @@ void Console::ProcessWorkRamWrite(uint32_t addr, uint8_t value) } } -void Console::ProcessNecDspExec(uint32_t addr, uint32_t value) -{ - if(_debugger) { - _debugger->ProcessNecDspExec(addr, value); - } -} - void Console::ProcessCx4Exec() { if(_debugger) { @@ -884,11 +877,13 @@ template void Console::ProcessMemoryRead(uint32_t addr, uint8_t va template void Console::ProcessMemoryRead(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Console::ProcessMemoryRead(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Console::ProcessMemoryRead(uint32_t addr, uint8_t value, MemoryOperationType opType); +template void Console::ProcessMemoryRead(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Console::ProcessMemoryWrite(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Console::ProcessMemoryWrite(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Console::ProcessMemoryWrite(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Console::ProcessMemoryWrite(uint32_t addr, uint8_t value, MemoryOperationType opType); +template void Console::ProcessMemoryWrite(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Console::ProcessInterrupt(uint32_t originalPc, uint32_t currentPc, bool forNmi); template void Console::ProcessInterrupt(uint32_t originalPc, uint32_t currentPc, bool forNmi); \ No newline at end of file diff --git a/Core/Console.h b/Core/Console.h index fec8329..36998bb 100644 --- a/Core/Console.h +++ b/Core/Console.h @@ -173,7 +173,6 @@ public: void ProcessPpuWrite(uint32_t addr, uint8_t value, SnesMemoryType memoryType); void ProcessWorkRamRead(uint32_t addr, uint8_t value); void ProcessWorkRamWrite(uint32_t addr, uint8_t value); - void ProcessNecDspExec(uint32_t addr, uint32_t value); void ProcessCx4Exec(); void ProcessPpuCycle(); template void ProcessInterrupt(uint32_t originalPc, uint32_t currentPc, bool forNmi); diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 6f304f4..b44a0f7 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -63,6 +63,7 @@ + @@ -250,6 +251,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index b8ff1c3..460d6ce 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -515,6 +515,9 @@ SNES\Coprocessors\BSX + + Debugger\Debuggers + @@ -827,6 +830,9 @@ SNES\Coprocessors\BSX + + Debugger\Debuggers + diff --git a/Core/DebugTypes.h b/Core/DebugTypes.h index fbd7d33..96c511e 100644 --- a/Core/DebugTypes.h +++ b/Core/DebugTypes.h @@ -31,6 +31,7 @@ enum class SnesMemoryType CpuMemory, SpcMemory, Sa1Memory, + NecDspMemory, GsuMemory, PrgRom, WorkRam, diff --git a/Core/DebugUtilities.h b/Core/DebugUtilities.h index 7d8be3e..e77d04f 100644 --- a/Core/DebugUtilities.h +++ b/Core/DebugUtilities.h @@ -10,11 +10,11 @@ public: switch(type) { case CpuType::Cpu: return SnesMemoryType::CpuMemory; case CpuType::Spc: return SnesMemoryType::SpcMemory; + case CpuType::NecDsp: return SnesMemoryType::NecDspMemory; case CpuType::Sa1: return SnesMemoryType::Sa1Memory; case CpuType::Gsu: return SnesMemoryType::GsuMemory; case CpuType::Cx4: break; - case CpuType::NecDsp: break; } throw std::runtime_error("Invalid CPU type"); diff --git a/Core/Debugger.cpp b/Core/Debugger.cpp index ab7b707..823544a 100644 --- a/Core/Debugger.cpp +++ b/Core/Debugger.cpp @@ -12,6 +12,7 @@ #include "CpuDebugger.h" #include "SpcDebugger.h" #include "GsuDebugger.h" +#include "NecDspDebugger.h" #include "BaseCartridge.h" #include "MemoryManager.h" #include "EmuSettings.h" @@ -58,6 +59,7 @@ Debugger::Debugger(shared_ptr console) _watchExpEval[(int)CpuType::Spc].reset(new ExpressionEvaluator(this, CpuType::Spc)); _watchExpEval[(int)CpuType::Sa1].reset(new ExpressionEvaluator(this, CpuType::Sa1)); _watchExpEval[(int)CpuType::Gsu].reset(new ExpressionEvaluator(this, CpuType::Gsu)); + _watchExpEval[(int)CpuType::NecDsp].reset(new ExpressionEvaluator(this, CpuType::NecDsp)); _codeDataLogger.reset(new CodeDataLogger(_cart->DebugGetPrgRomSize(), _memoryManager.get())); _memoryDumper.reset(new MemoryDumper(this)); @@ -75,6 +77,8 @@ Debugger::Debugger(shared_ptr console) _sa1Debugger.reset(new CpuDebugger(this, CpuType::Sa1)); } else if(_cart->GetGsu()) { _gsuDebugger.reset(new GsuDebugger(this)); + } else if(_cart->GetDsp()) { + _necDspDebugger.reset(new NecDspDebugger(this)); } _step.reset(new StepRequest()); @@ -124,6 +128,7 @@ void Debugger::ProcessMemoryRead(uint32_t addr, uint8_t value, MemoryOperationTy switch(type) { case CpuType::Cpu: _cpuDebugger->ProcessRead(addr, value, opType); break; case CpuType::Spc: _spcDebugger->ProcessRead(addr, value, opType); break; + case CpuType::NecDsp: _necDspDebugger->ProcessRead(addr, value, opType); break; case CpuType::Sa1: _sa1Debugger->ProcessRead(addr, value, opType); break; case CpuType::Gsu: _gsuDebugger->ProcessRead(addr, value, opType); break; } @@ -135,6 +140,7 @@ void Debugger::ProcessMemoryWrite(uint32_t addr, uint8_t value, MemoryOperationT switch(type) { case CpuType::Cpu: _cpuDebugger->ProcessWrite(addr, value, opType); break; case CpuType::Spc: _spcDebugger->ProcessWrite(addr, value, opType); break; + case CpuType::NecDsp: _necDspDebugger->ProcessWrite(addr, value, opType); break; case CpuType::Sa1: _sa1Debugger->ProcessWrite(addr, value, opType); break; case CpuType::Gsu: _gsuDebugger->ProcessWrite(addr, value, opType); break; } @@ -202,21 +208,6 @@ void Debugger::ProcessPpuCycle() } } -void Debugger::ProcessNecDspExec(uint32_t addr, uint32_t value) -{ - if(_traceLogger->IsCpuLogged(CpuType::NecDsp)) { - AddressInfo addressInfo { (int32_t)addr * 4, SnesMemoryType::DspProgramRom }; - - _disassembler->BuildCache(addressInfo, 0, CpuType::NecDsp); - - DebugState debugState; - GetState(debugState, true); - - DisassemblyInfo disInfo = _disassembler->GetDisassemblyInfo(addressInfo); - _traceLogger->Log(CpuType::NecDsp, debugState, disInfo); - } -} - void Debugger::ProcessCx4Exec() { if(_traceLogger->IsCpuLogged(CpuType::Cx4)) { @@ -248,6 +239,8 @@ void Debugger::SleepUntilResume(BreakSource source, MemoryOperationInfo *operati _disassembler->Disassemble(CpuType::Sa1); } else if(_cart->GetGsu()) { _disassembler->Disassemble(CpuType::Gsu); + } else if(_cart->GetDsp()) { + _disassembler->Disassemble(CpuType::NecDsp); } _executionStopped = true; @@ -338,6 +331,9 @@ void Debugger::Run() if(_gsuDebugger) { _gsuDebugger->Run(); } + if(_necDspDebugger) { + _necDspDebugger->Run(); + } _waitForBreakResume = false; } @@ -353,9 +349,9 @@ void Debugger::Step(CpuType cpuType, int32_t stepCount, StepType type) switch(cpuType) { case CpuType::Cpu: debugger = _cpuDebugger.get(); break; case CpuType::Spc: debugger = _spcDebugger.get(); break; + case CpuType::NecDsp: debugger = _necDspDebugger.get(); break; case CpuType::Sa1: debugger = _sa1Debugger.get(); break; case CpuType::Gsu: debugger = _gsuDebugger.get(); break; - case CpuType::NecDsp: case CpuType::Cx4: throw std::runtime_error("Step(): Unsupported CPU type."); } @@ -378,7 +374,9 @@ void Debugger::Step(CpuType cpuType, int32_t stepCount, StepType type) if(_gsuDebugger && debugger != _gsuDebugger.get()) { _gsuDebugger->Run(); } - + if(_necDspDebugger && debugger != _necDspDebugger.get()) { + _necDspDebugger->Run(); + } _waitForBreakResume = false; } @@ -455,6 +453,8 @@ AddressInfo Debugger::GetAbsoluteAddress(AddressInfo relAddress) return _cart->GetSa1()->GetMemoryMappings()->GetAbsoluteAddress(relAddress.Address); } else if(relAddress.Type == SnesMemoryType::GsuMemory) { return _cart->GetGsu()->GetMemoryMappings()->GetAbsoluteAddress(relAddress.Address); + } else if(relAddress.Type == SnesMemoryType::NecDspMemory) { + return { relAddress.Address, SnesMemoryType::DspProgramRom }; } throw std::runtime_error("Unsupported address type"); @@ -499,6 +499,10 @@ AddressInfo Debugger::GetRelativeAddress(AddressInfo absAddress, CpuType cpuType case SnesMemoryType::SpcRom: return { _spc->GetRelativeAddress(absAddress), SnesMemoryType::SpcMemory }; + + case SnesMemoryType::DspProgramRom: + return { absAddress.Address, SnesMemoryType::NecDspMemory }; + case SnesMemoryType::Register: return { absAddress.Address & 0xFFFF, SnesMemoryType::Register }; @@ -546,6 +550,9 @@ void Debugger::SetBreakpoints(Breakpoint breakpoints[], uint32_t length) if(_sa1Debugger) { _sa1Debugger->GetBreakpointManager()->SetBreakpoints(breakpoints, length); } + if(_necDspDebugger) { + _necDspDebugger->GetBreakpointManager()->SetBreakpoints(breakpoints, length); + } } void Debugger::SaveRomToDisk(string filename, bool saveAsIps, CdlStripOption stripOption) @@ -647,11 +654,13 @@ template void Debugger::ProcessMemoryRead(uint32_t addr, uint8_t v template void Debugger::ProcessMemoryRead(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Debugger::ProcessMemoryRead(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Debugger::ProcessMemoryRead(uint32_t addr, uint8_t value, MemoryOperationType opType); +template void Debugger::ProcessMemoryRead(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Debugger::ProcessMemoryWrite(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Debugger::ProcessMemoryWrite(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Debugger::ProcessMemoryWrite(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Debugger::ProcessMemoryWrite(uint32_t addr, uint8_t value, MemoryOperationType opType); +template void Debugger::ProcessMemoryWrite(uint32_t addr, uint8_t value, MemoryOperationType opType); template void Debugger::ProcessInterrupt(uint32_t originalPc, uint32_t currentPc, bool forNmi); template void Debugger::ProcessInterrupt(uint32_t originalPc, uint32_t currentPc, bool forNmi); diff --git a/Core/Debugger.h b/Core/Debugger.h index 488cdcf..afb9155 100644 --- a/Core/Debugger.h +++ b/Core/Debugger.h @@ -30,6 +30,7 @@ class ScriptManager; class SpcDebugger; class CpuDebugger; class GsuDebugger; +class NecDspDebugger; class Breakpoint; class Assembler; @@ -53,6 +54,7 @@ private: unique_ptr _cpuDebugger; unique_ptr _sa1Debugger; unique_ptr _gsuDebugger; + unique_ptr _necDspDebugger; shared_ptr _scriptManager; shared_ptr _traceLogger; @@ -96,7 +98,6 @@ public: void ProcessPpuWrite(uint16_t addr, uint8_t value, SnesMemoryType memoryType); void ProcessPpuCycle(); - void ProcessNecDspExec(uint32_t addr, uint32_t value); void ProcessCx4Exec(); template diff --git a/Core/Disassembler.cpp b/Core/Disassembler.cpp index 0a94c47..f198cec 100644 --- a/Core/Disassembler.cpp +++ b/Core/Disassembler.cpp @@ -50,7 +50,6 @@ Disassembler::Disassembler(shared_ptr console, shared_ptrGetSpcRom(); _spcRomSize = Spc::SpcRomSize; - _necDspProgramRom = cart->GetDsp() ? cart->GetDsp()->DebugGetProgramRom() : nullptr; _necDspProgramRomSize = cart->GetDsp() ? cart->GetDsp()->DebugGetProgramRomSize() : 0; @@ -90,6 +89,12 @@ Disassembler::Disassembler(shared_ptr console, shared_ptr 0) { + //Build cache for the entire DSP chip (since it only contains instructions) + AddressInfo dspStart = { 0, SnesMemoryType::DspProgramRom }; + BuildCache(dspStart, 0, CpuType::NecDsp); + } } DisassemblerSource Disassembler::GetSource(SnesMemoryType type) @@ -106,9 +111,9 @@ vector& Disassembler::GetDisassemblyList(CpuType type) switch(type) { case CpuType::Cpu: return _disassembly; case CpuType::Spc: return _spcDisassembly; + case CpuType::NecDsp: return _necDspDisassembly; case CpuType::Sa1: return _sa1Disassembly; case CpuType::Gsu: return _gsuDisassembly; - case CpuType::NecDsp: break; case CpuType::Cx4: break; } throw std::runtime_error("Disassembly::GetDisassemblyList(): Invalid cpu type"); @@ -157,8 +162,8 @@ void Disassembler::SetDisassembleFlag(CpuType type) _needDisassemble[(int)CpuType::Cpu] = true; _needDisassemble[(int)CpuType::Sa1] = true; _needDisassemble[(int)CpuType::Gsu] = true; - } else if(type == CpuType::Spc) { - _needDisassemble[(int)CpuType::Spc] = true; + } else { + _needDisassemble[(int)type] = true; } } @@ -202,9 +207,13 @@ void Disassembler::Disassemble(CpuType cpuType) auto lock = _disassemblyLock.AcquireSafe(); bool isSpc = cpuType == CpuType::Spc; + bool isDsp = cpuType == CpuType::NecDsp; MemoryMappings *mappings = nullptr; + int32_t maxAddr = 0xFFFFFF; switch(cpuType) { - case CpuType::Cpu: mappings = _memoryManager->GetMemoryMappings(); break; + case CpuType::Cpu: + mappings = _memoryManager->GetMemoryMappings(); + break; case CpuType::Sa1: if(!_console->GetCartridge()->GetSa1()) { @@ -220,12 +229,23 @@ void Disassembler::Disassemble(CpuType cpuType) mappings = _console->GetCartridge()->GetGsu()->GetMemoryMappings(); break; - case CpuType::Spc: mappings = nullptr; break; + case CpuType::NecDsp: + if(!_console->GetCartridge()->GetDsp()) { + return; + } + mappings = nullptr; + maxAddr = _necDspProgramRomSize - 1; + break; + + case CpuType::Spc: + mappings = nullptr; + maxAddr = 0xFFFF; + break; + default: throw std::runtime_error("Disassemble(): Invalid cpu type"); } vector &results = GetDisassemblyList(cpuType); - int32_t maxAddr = isSpc ? 0xFFFF : 0xFFFFFF; results.clear(); bool disUnident = _settings->CheckDebuggerFlag(DebuggerFlags::DisassembleUnidentifiedData); @@ -241,7 +261,11 @@ void Disassembler::Disassemble(CpuType cpuType) int byteCounter = 0; for(int32_t i = 0; i <= maxAddr; i++) { prevAddrInfo = addrInfo; - addrInfo = isSpc ? _spc->GetAbsoluteAddress(i) : mappings->GetAbsoluteAddress(i); + if(isDsp) { + addrInfo = { i, SnesMemoryType::DspProgramRom }; + } else { + addrInfo = isSpc ? _spc->GetAbsoluteAddress(i) : mappings->GetAbsoluteAddress(i); + } if(addrInfo.Address < 0) { continue; @@ -536,9 +560,20 @@ bool Disassembler::GetLineData(CpuType type, uint32_t lineIndex, CodeLineData &d } break; } + + case CpuType::NecDsp: + if(!disInfo.IsInitialized()) { + disInfo = DisassemblyInfo(src.Data + result.Address.Address, 0, CpuType::NecDsp); + } else { + data.Flags |= LineFlags::VerifiedCode; + } + + data.OpSize = disInfo.GetOpSize(); + data.EffectiveAddress = -1; + data.ValueSize = 0; + break; case CpuType::Cx4: - case CpuType::NecDsp: throw std::runtime_error("GetLineData - CPU type not supported"); } diff --git a/Core/Disassembler.h b/Core/Disassembler.h index c33f79a..36327a7 100644 --- a/Core/Disassembler.h +++ b/Core/Disassembler.h @@ -53,6 +53,7 @@ private: vector _spcDisassembly; vector _sa1Disassembly; vector _gsuDisassembly; + vector _necDspDisassembly; DisassemblerSource _sources[(int)SnesMemoryType::Register]; diff --git a/Core/DisassemblyInfo.cpp b/Core/DisassemblyInfo.cpp index 7026efc..42ec8e8 100644 --- a/Core/DisassemblyInfo.cpp +++ b/Core/DisassemblyInfo.cpp @@ -139,7 +139,7 @@ uint8_t DisassemblyInfo::GetOpSize(uint8_t opCode, uint8_t flags, CpuType type) } return 1; - case CpuType::NecDsp: return 4; + case CpuType::NecDsp: return 3; case CpuType::Cx4: return 2; } return 0; @@ -206,9 +206,11 @@ bool DisassemblyInfo::UpdateCpuFlags(uint8_t &cpuFlags) case CpuType::Gsu: case CpuType::Spc: - case CpuType::NecDsp: case CpuType::Cx4: return false; + + case CpuType::NecDsp: + return true; } return false; diff --git a/Core/Gsu.cpp b/Core/Gsu.cpp index 6bf355b..63b3cac 100644 --- a/Core/Gsu.cpp +++ b/Core/Gsu.cpp @@ -68,6 +68,11 @@ Gsu::Gsu(Console *console, uint32_t gsuRamSize) _mappings.RegisterHandler(0x70, 0x71, 0x0000, 0xFFFF, _gsuRamHandlers); } +Gsu::~Gsu() +{ + delete[] _gsuRam; +} + void Gsu::ProcessEndOfFrame() { uint8_t clockMultiplier = _settings->GetEmulationConfig().GsuClockSpeed / 100; diff --git a/Core/Gsu.h b/Core/Gsu.h index eefab1b..a3c0eaa 100644 --- a/Core/Gsu.h +++ b/Core/Gsu.h @@ -145,6 +145,7 @@ private: public: Gsu(Console *console, uint32_t gsuRamSize); + virtual ~Gsu(); void ProcessEndOfFrame() override; diff --git a/Core/LabelManager.cpp b/Core/LabelManager.cpp index b91e022..7f38352 100644 --- a/Core/LabelManager.cpp +++ b/Core/LabelManager.cpp @@ -52,6 +52,7 @@ int64_t LabelManager::GetLabelKey(uint32_t absoluteAddr, SnesMemoryType memType) case SnesMemoryType::GsuWorkRam: return absoluteAddr | ((uint64_t)8 << 32); case SnesMemoryType::BsxPsRam: return absoluteAddr | ((uint64_t)9 << 32); case SnesMemoryType::BsxMemoryPack: return absoluteAddr | ((uint64_t)10 << 32); + case SnesMemoryType::DspProgramRom: return absoluteAddr | ((uint64_t)11 << 32); default: return -1; } } @@ -69,6 +70,7 @@ SnesMemoryType LabelManager::GetKeyMemoryType(uint64_t key) case ((uint64_t)8 << 32): return SnesMemoryType::GsuWorkRam; break; case ((uint64_t)9 << 32): return SnesMemoryType::BsxPsRam; break; case ((uint64_t)10 << 32): return SnesMemoryType::BsxMemoryPack; break; + case ((uint64_t)11 << 32): return SnesMemoryType::DspProgramRom; break; } throw std::runtime_error("Invalid label key"); diff --git a/Core/MemoryDumper.cpp b/Core/MemoryDumper.cpp index 9877129..a8ecba6 100644 --- a/Core/MemoryDumper.cpp +++ b/Core/MemoryDumper.cpp @@ -50,7 +50,7 @@ void MemoryDumper::SetMemoryState(SnesMemoryType type, uint8_t *buffer, uint32_t case SnesMemoryType::SpcRam: memcpy(_spc->GetSpcRam(), buffer, length); break; case SnesMemoryType::SpcRom: memcpy(_spc->GetSpcRom(), buffer, length); break; - case SnesMemoryType::DspProgramRom: memcpy(_cartridge->GetDsp()->DebugGetProgramRom(), buffer, length); break; + case SnesMemoryType::DspProgramRom: memcpy(_cartridge->GetDsp()->DebugGetProgramRom(), buffer, length); _cartridge->GetDsp()->BuildProgramCache(); break; case SnesMemoryType::DspDataRom: memcpy(_cartridge->GetDsp()->DebugGetDataRom(), buffer, length); break; case SnesMemoryType::DspDataRam: memcpy(_cartridge->GetDsp()->DebugGetDataRam(), buffer, length); break; @@ -188,7 +188,7 @@ void MemoryDumper::SetMemoryValue(SnesMemoryType memoryType, uint32_t address, u case SnesMemoryType::SpcRam: _spc->GetSpcRam()[address] = value; invalidateCache(); break; case SnesMemoryType::SpcRom: _spc->GetSpcRom()[address] = value; invalidateCache(); break; - case SnesMemoryType::DspProgramRom: _cartridge->GetDsp()->DebugGetProgramRom()[address] = value; invalidateCache(); break; + case SnesMemoryType::DspProgramRom: _cartridge->GetDsp()->DebugGetProgramRom()[address] = value; _cartridge->GetDsp()->BuildProgramCache(); break; case SnesMemoryType::DspDataRom: _cartridge->GetDsp()->DebugGetDataRom()[address] = value; break; case SnesMemoryType::DspDataRam: _cartridge->GetDsp()->DebugGetDataRam()[address] = value; break; diff --git a/Core/NecDsp.cpp b/Core/NecDsp.cpp index 79dc648..a40d805 100644 --- a/Core/NecDsp.cpp +++ b/Core/NecDsp.cpp @@ -53,9 +53,10 @@ NecDsp::NecDsp(CoprocessorType type, Console* console, vector &programR } } - _progSize = (uint32_t)programRom.size() / 3; - _progRom = new uint32_t[_progSize]; - _progMask = _progSize - 1; + _progSize = (uint32_t)programRom.size(); + _progRom = new uint8_t[_progSize]; + _prgCache = new uint32_t[_progSize / 3]; + _progMask = (_progSize / 3)- 1; _dataSize = (uint32_t)dataRom.size() / 2; _dataRom = new uint16_t[_dataSize]; @@ -69,14 +70,22 @@ NecDsp::NecDsp(CoprocessorType type, Console* console, vector &programR console->GetSettings()->InitializeRam(_ram, _ramSize * sizeof(uint16_t)); console->GetSettings()->InitializeRam(_stack, _stackSize * sizeof(uint16_t)); - for(uint32_t i = 0; i < _progSize; i++) { - _progRom[i] = programRom[i * 3] | (programRom[i * 3 + 1] << 8) | (programRom[i * 3 + 2] << 16); - } + memcpy(_progRom, programRom.data(), _progSize); + BuildProgramCache(); + for(uint32_t i = 0; i < _dataSize; i++) { _dataRom[i] = dataRom[i * 2] | (dataRom[i * 2 + 1] << 8); } } +NecDsp::~NecDsp() +{ + delete[] _progRom; + delete[] _prgCache; + delete[] _dataRom; + delete[] _ram; +} + NecDsp* NecDsp::InitCoprocessor(CoprocessorType type, Console *console, vector &embeddedFirware) { bool firmwareLoaded = false; @@ -120,18 +129,31 @@ void NecDsp::SaveBattery() } } +void NecDsp::BuildProgramCache() +{ + //For the sake of performance, keep a precalculated array of 24-bit opcodes for each entry in the ROM + for(uint32_t i = 0; i < _progSize / 3; i++) { + _prgCache[i] = _progRom[i * 3] | (_progRom[i * 3 + 1] << 8) | (_progRom[i * 3 + 2] << 16); + } +} + +void NecDsp::ReadOpCode() +{ + _opCode = _prgCache[_state.PC & _progMask]; + _console->ProcessMemoryRead((_state.PC & _progMask) * 3, _opCode, MemoryOperationType::ExecOpCode); +} + void NecDsp::Run() { uint64_t targetCycle = (uint64_t)(_memoryManager->GetMasterClock() * (_frequency / _console->GetMasterClockRate())); - if(_inRqmLoop) { + if(_inRqmLoop && !_console->IsDebugging()) { _cycleCount = targetCycle; return; } while(_cycleCount < targetCycle) { - _opCode = _progRom[_state.PC & _progMask]; - _console->ProcessNecDspExec(_state.PC, _opCode); + ReadOpCode(); _state.PC++; switch(_opCode & 0xC00000) { @@ -517,7 +539,7 @@ uint16_t NecDsp::GetSourceValue(uint8_t source) uint8_t* NecDsp::DebugGetProgramRom() { - return (uint8_t*)_progRom; + return _progRom; } uint8_t* NecDsp::DebugGetDataRom() @@ -532,7 +554,7 @@ uint8_t* NecDsp::DebugGetDataRam() uint32_t NecDsp::DebugGetProgramRomSize() { - return _progSize * sizeof(uint32_t); + return _progSize; } uint32_t NecDsp::DebugGetDataRomSize() diff --git a/Core/NecDsp.h b/Core/NecDsp.h index ce18f43..e40ecc5 100644 --- a/Core/NecDsp.h +++ b/Core/NecDsp.h @@ -19,7 +19,8 @@ private: double _frequency = 7600000; uint32_t _opCode = 0; - uint32_t *_progRom = nullptr; + uint8_t *_progRom = nullptr; + uint32_t *_prgCache = nullptr; uint16_t *_dataRom = nullptr; uint16_t *_ram = nullptr; uint16_t _stack[16]; @@ -38,6 +39,8 @@ private: uint16_t _registerMask = 0; bool _inRqmLoop = false; + void ReadOpCode(); + void RunApuOp(uint8_t aluOperation, uint16_t source); void UpdateDataPointer(); @@ -51,6 +54,8 @@ private: NecDsp(CoprocessorType type, Console* console, vector &programRom, vector &dataRom); public: + virtual ~NecDsp(); + static NecDsp* InitCoprocessor(CoprocessorType type, Console* console, vector &embeddedFirmware); void Reset() override; @@ -58,6 +63,8 @@ public: void LoadBattery() override; void SaveBattery() override; + + void BuildProgramCache(); uint8_t Read(uint32_t addr) override; void Write(uint32_t addr, uint8_t value) override; diff --git a/Core/NecDspDebugger.cpp b/Core/NecDspDebugger.cpp new file mode 100644 index 0000000..3b03c18 --- /dev/null +++ b/Core/NecDspDebugger.cpp @@ -0,0 +1,101 @@ +#include "stdafx.h" +#include "NecDsp.h" +#include "NecDspDebugger.h" +#include "DisassemblyInfo.h" +#include "Disassembler.h" +#include "TraceLogger.h" +#include "CallstackManager.h" +#include "BreakpointManager.h" +#include "BaseCartridge.h" +#include "MemoryManager.h" +#include "Debugger.h" +#include "Console.h" +#include "MemoryAccessCounter.h" +#include "ExpressionEvaluator.h" +#include "EmuSettings.h" + +NecDspDebugger::NecDspDebugger(Debugger* debugger) +{ + _debugger = debugger; + _traceLogger = debugger->GetTraceLogger().get(); + _disassembler = debugger->GetDisassembler().get(); + _dsp = debugger->GetConsole()->GetCartridge()->GetDsp(); + _settings = debugger->GetConsole()->GetSettings().get(); + + _breakpointManager.reset(new BreakpointManager(debugger, CpuType::NecDsp)); + _step.reset(new StepRequest()); +} + +void NecDspDebugger::Reset() +{ +} + +void NecDspDebugger::ProcessRead(uint16_t addr, uint8_t value, MemoryOperationType type) +{ + AddressInfo addressInfo = { (uint32_t)addr, type == MemoryOperationType::ExecOpCode ? SnesMemoryType::DspProgramRom : SnesMemoryType::DspDataRom }; + MemoryOperationInfo operation { (uint32_t)addr, value, type }; + + if(type == MemoryOperationType::ExecOpCode) { + if(_traceLogger->IsCpuLogged(CpuType::NecDsp) || _settings->CheckDebuggerFlag(DebuggerFlags::NecDspDebuggerEnabled)) { + _disassembler->BuildCache(addressInfo, 0, CpuType::NecDsp); + + if(_traceLogger->IsCpuLogged(CpuType::NecDsp)) { + DebugState debugState; + _debugger->GetState(debugState, true); + + DisassemblyInfo disInfo = _disassembler->GetDisassemblyInfo(addressInfo); + _traceLogger->Log(CpuType::NecDsp, debugState, disInfo); + } + } + + _prevProgramCounter = addr; + + if(_step->StepCount > 0) { + _step->StepCount--; + } + } + + _debugger->ProcessBreakConditions(_step->StepCount == 0, GetBreakpointManager(), operation, addressInfo); +} + +void NecDspDebugger::ProcessWrite(uint16_t addr, uint8_t value, MemoryOperationType type) +{ + AddressInfo addressInfo { addr, SnesMemoryType::DspDataRam }; //Writes never affect the DSP ROM + MemoryOperationInfo operation { addr, value, type }; + _debugger->ProcessBreakConditions(false, GetBreakpointManager(), operation, addressInfo); +} + +void NecDspDebugger::Run() +{ + _step.reset(new StepRequest()); +} + +void NecDspDebugger::Step(int32_t stepCount, StepType type) +{ + StepRequest step; + + switch(type) { + case StepType::Step: step.StepCount = stepCount; break; + + case StepType::StepOut: + case StepType::StepOver: + step.StepCount = 1; + break; + + case StepType::SpecificScanline: + case StepType::PpuStep: + break; + } + + _step.reset(new StepRequest(step)); +} + +shared_ptr NecDspDebugger::GetCallstackManager() +{ + return nullptr; +} + +BreakpointManager* NecDspDebugger::GetBreakpointManager() +{ + return _breakpointManager.get(); +} \ No newline at end of file diff --git a/Core/NecDspDebugger.h b/Core/NecDspDebugger.h new file mode 100644 index 0000000..e8df7c7 --- /dev/null +++ b/Core/NecDspDebugger.h @@ -0,0 +1,40 @@ +#pragma once +#include "stdafx.h" +#include "DebugTypes.h" +#include "IDebugger.h" + +class Disassembler; +class Debugger; +class TraceLogger; +class NecDsp; +class CallstackManager; +class MemoryAccessCounter; +class MemoryManager; +class BreakpointManager; +class EmuSettings; + +class NecDspDebugger final : public IDebugger +{ + Debugger* _debugger; + Disassembler* _disassembler; + TraceLogger* _traceLogger; + NecDsp* _dsp; + EmuSettings* _settings; + + unique_ptr _breakpointManager; + unique_ptr _step; + + uint32_t _prevProgramCounter = 0; + +public: + NecDspDebugger(Debugger* debugger); + + void Reset(); + + void ProcessRead(uint16_t addr, uint8_t value, MemoryOperationType type); + void ProcessWrite(uint16_t addr, uint8_t value, MemoryOperationType type); + void Run(); + void Step(int32_t stepCount, StepType type); + shared_ptr GetCallstackManager(); + BreakpointManager* GetBreakpointManager(); +}; \ No newline at end of file diff --git a/Core/NecDspDisUtils.cpp b/Core/NecDspDisUtils.cpp index 683a61b..7d61229 100644 --- a/Core/NecDspDisUtils.cpp +++ b/Core/NecDspDisUtils.cpp @@ -2,8 +2,10 @@ #include "NecDspDisUtils.h" #include "DisassemblyInfo.h" #include "EmuSettings.h" +#include "LabelManager.h" #include "../Utilities/HexUtilities.h" #include "../Utilities/FastString.h" +#include "DebugTypes.h" void NecDspDisUtils::GetDisassembly(DisassemblyInfo &info, string &out, uint32_t memoryAddr, LabelManager *labelManager, EmuSettings* settings) { @@ -67,6 +69,8 @@ void NecDspDisUtils::GetDisassembly(DisassemblyInfo &info, string &out, uint32_t if(operationType == 1) { str.Delimiter(" | "); str.Write("RET"); + } else if(opCode == 0) { + str.Write("NOP"); } } else if(operationType == 2) { //Jump @@ -116,8 +120,15 @@ void NecDspDisUtils::GetDisassembly(DisassemblyInfo &info, string &out, uint32_t case 0x141: str.Write("HCALL"); target |= 0x2000; break; default: str.Write(""); break; } + str.Write(' '); - str.WriteAll(" $", HexUtilities::ToHex(target)); + AddressInfo absAddress = { (int32_t)target*3, SnesMemoryType::DspProgramRom }; + string label = labelManager->GetLabel(absAddress); + if(label.empty()) { + str.WriteAll('$', HexUtilities::ToHex(target * 3)); + } else { + str.Write(label, true); + } } else if(operationType == 3) { //Load uint16_t value = opCode >> 6; diff --git a/Core/Sa1.cpp b/Core/Sa1.cpp index 171615c..b7e6908 100644 --- a/Core/Sa1.cpp +++ b/Core/Sa1.cpp @@ -65,6 +65,11 @@ Sa1::Sa1(Console* console) Reset(); } +Sa1::~Sa1() +{ + delete[] _iRam; +} + void Sa1::Sa1RegisterWrite(uint16_t addr, uint8_t value) { switch(addr) { diff --git a/Core/Sa1.h b/Core/Sa1.h index 46de790..7e3150d 100644 --- a/Core/Sa1.h +++ b/Core/Sa1.h @@ -61,6 +61,7 @@ private: public: Sa1(Console* console); + virtual ~Sa1(); void WriteSa1(uint32_t addr, uint8_t value, MemoryOperationType type); uint8_t ReadSa1(uint32_t addr, MemoryOperationType type = MemoryOperationType::Read); diff --git a/Core/SettingTypes.h b/Core/SettingTypes.h index 1281c6c..e4386c1 100644 --- a/Core/SettingTypes.h +++ b/Core/SettingTypes.h @@ -486,6 +486,7 @@ enum class DebuggerFlags : uint32_t UseAltSpcOpNames = 0x1000, UseLowerCaseDisassembly = 0x2000, + NecDspDebuggerEnabled = 0x08000000, GsuDebuggerEnabled = 0x10000000, Sa1DebuggerEnabled = 0x20000000, SpcDebuggerEnabled = 0x40000000, diff --git a/UI/Debugger/Breakpoints/Breakpoint.cs b/UI/Debugger/Breakpoints/Breakpoint.cs index 405e045..8935831 100644 --- a/UI/Debugger/Breakpoints/Breakpoint.cs +++ b/UI/Debugger/Breakpoints/Breakpoint.cs @@ -110,6 +110,7 @@ namespace Mesen.GUI.Debugger case SnesMemoryType.SpcMemory: type = "SPC"; break; case SnesMemoryType.Sa1Memory: type = "SA1"; break; case SnesMemoryType.GsuMemory: type = "GSU"; break; + case SnesMemoryType.NecDspMemory: type = "DSP"; break; case SnesMemoryType.PrgRom: type = "PRG"; break; case SnesMemoryType.WorkRam: type = "WRAM"; break; @@ -121,6 +122,7 @@ namespace Mesen.GUI.Debugger case SnesMemoryType.SpcRam: type = "RAM"; break; case SnesMemoryType.SpcRom: type = "ROM"; break; + case SnesMemoryType.DspProgramRom: type = "DSP"; break; case SnesMemoryType.Sa1InternalRam: type = "IRAM"; break; case SnesMemoryType.GsuWorkRam: type = "GWRAM"; break; diff --git a/UI/Debugger/Breakpoints/ctrlBreakpoints.cs b/UI/Debugger/Breakpoints/ctrlBreakpoints.cs index 5fa3c13..1ed2b7f 100644 --- a/UI/Debugger/Breakpoints/ctrlBreakpoints.cs +++ b/UI/Debugger/Breakpoints/ctrlBreakpoints.cs @@ -131,7 +131,8 @@ namespace Mesen.GUI.Debugger.Controls private void mnuAddBreakpoint_Click(object sender, EventArgs e) { - Breakpoint breakpoint = new Breakpoint() { MemoryType = _cpuType.ToMemoryType(), CpuType = _cpuType }; + SnesMemoryType memType = _cpuType == CpuType.NecDsp ? SnesMemoryType.DspProgramRom : _cpuType.ToMemoryType(); + Breakpoint breakpoint = new Breakpoint() { MemoryType = memType, CpuType = _cpuType }; if(new frmBreakpoint(breakpoint).ShowDialog() == DialogResult.OK) { BreakpointManager.AddBreakpoint(breakpoint); } diff --git a/UI/Debugger/Breakpoints/frmBreakpoint.Designer.cs b/UI/Debugger/Breakpoints/frmBreakpoint.Designer.cs index bc20aab..49c17f7 100644 --- a/UI/Debugger/Breakpoints/frmBreakpoint.Designer.cs +++ b/UI/Debugger/Breakpoints/frmBreakpoint.Designer.cs @@ -398,7 +398,7 @@ this.cboBreakpointType.FormattingEnabled = true; this.cboBreakpointType.Location = new System.Drawing.Point(3, 3); this.cboBreakpointType.Name = "cboBreakpointType"; - this.cboBreakpointType.Size = new System.Drawing.Size(121, 21); + this.cboBreakpointType.Size = new System.Drawing.Size(159, 21); this.cboBreakpointType.TabIndex = 13; this.cboBreakpointType.SelectedIndexChanged += new System.EventHandler(this.cboBreakpointType_SelectedIndexChanged); // @@ -407,7 +407,7 @@ this.lblRange.Anchor = System.Windows.Forms.AnchorStyles.Left; this.lblRange.AutoSize = true; this.lblRange.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.lblRange.Location = new System.Drawing.Point(130, 6); + this.lblRange.Location = new System.Drawing.Point(168, 6); this.lblRange.Name = "lblRange"; this.lblRange.Size = new System.Drawing.Size(40, 13); this.lblRange.TabIndex = 6; diff --git a/UI/Debugger/Breakpoints/frmBreakpoint.cs b/UI/Debugger/Breakpoints/frmBreakpoint.cs index 55c3ab5..0050c63 100644 --- a/UI/Debugger/Breakpoints/frmBreakpoint.cs +++ b/UI/Debugger/Breakpoints/frmBreakpoint.cs @@ -76,6 +76,10 @@ namespace Mesen.GUI.Debugger cboBreakpointType.Items.Add("-"); cboBreakpointType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.SpcRam)); cboBreakpointType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.SpcRom)); + } else if(_cpuType == CpuType.NecDsp) { + cboBreakpointType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.DspProgramRom)); + cboBreakpointType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.DspDataRom)); + cboBreakpointType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.DspDataRam)); } this.toolTip.SetToolTip(this.picExpressionWarning, "Condition contains invalid syntax or symbols."); diff --git a/UI/Debugger/Code/CodeHighlighting.cs b/UI/Debugger/Code/CodeHighlighting.cs index 7badbc7..7c13a5b 100644 --- a/UI/Debugger/Code/CodeHighlighting.cs +++ b/UI/Debugger/Code/CodeHighlighting.cs @@ -14,7 +14,7 @@ namespace Mesen.GUI.Debugger.Code { private static Regex _space = new Regex("^[ \t]+", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static Regex _opCode = new Regex("^[a-z0-9]{2,5}", RegexOptions.IgnoreCase | RegexOptions.Compiled); - private static Regex _syntax = new Regex("^[]([)!+,.]{1}", RegexOptions.Compiled); + private static Regex _syntax = new Regex("^[]([)!+,.|:]{1}", RegexOptions.Compiled); private static Regex _operand = new Regex("^(([$][0-9a-f]*([.]\\d){0,1})|(#[@$:_0-9a-z]*)|([@_a-z]([@_a-z0-9])*))", RegexOptions.IgnoreCase | RegexOptions.Compiled); public static List GetCpuHighlights(CodeLineData lineData, bool highlightCode, string addressFormat, Color? textColor, bool showMemoryValues) diff --git a/UI/Debugger/Code/NecDspDisassemblyManager.cs b/UI/Debugger/Code/NecDspDisassemblyManager.cs new file mode 100644 index 0000000..4c439db --- /dev/null +++ b/UI/Debugger/Code/NecDspDisassemblyManager.cs @@ -0,0 +1,29 @@ +using Mesen.GUI.Debugger.Controls; +using Mesen.GUI.Debugger.Integration; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mesen.GUI.Debugger.Code +{ + public class NecDspDisassemblyManager : CpuDisassemblyManager + { + public override CpuType CpuType { get { return CpuType.NecDsp; } } + public override SnesMemoryType RelativeMemoryType { get { return SnesMemoryType.NecDspMemory; } } + public override int AddressSize { get { return 4; } } + public override int ByteCodeSize { get { return 3; } } + public override bool AllowSourceView { get { return false; } } + + public override void RefreshCode(ISymbolProvider symbolProvider, SourceFileInfo file) + { + this._provider = new CodeDataProvider(CpuType.NecDsp); + } + + protected override int GetFullAddress(int address, int length) + { + return address; + } + } +} diff --git a/UI/Debugger/Code/NecDspLineStyleProvider.cs b/UI/Debugger/Code/NecDspLineStyleProvider.cs new file mode 100644 index 0000000..25076aa --- /dev/null +++ b/UI/Debugger/Code/NecDspLineStyleProvider.cs @@ -0,0 +1,64 @@ +using Mesen.GUI.Config; +using Mesen.GUI.Debugger.Controls; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mesen.GUI.Debugger.Code +{ + public class NecDspLineStyleProvider : BaseStyleProvider + { + public NecDspLineStyleProvider() + { + } + + public override string GetLineComment(int lineNumber) + { + return null; + } + + public static void ConfigureActiveStatement(LineProperties props) + { + props.FgColor = Color.Black; + props.TextBgColor = ConfigManager.Config.Debug.Debugger.CodeActiveStatementColor; + props.Symbol |= LineSymbol.Arrow; + } + + public override LineProperties GetLineStyle(CodeLineData lineData, int lineIndex) + { + DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; + LineProperties props = new LineProperties(); + + if(lineData.Address >= 0) { + GetBreakpointLineProperties(props, lineData.Address); + } + + bool isActiveStatement = ActiveAddress.HasValue && ActiveAddress.Value == lineData.Address; + if(isActiveStatement) { + ConfigureActiveStatement(props); + } + + if(lineData.Flags.HasFlag(LineFlags.VerifiedData)) { + props.LineBgColor = cfg.CodeVerifiedDataColor; + } else if(!lineData.Flags.HasFlag(LineFlags.VerifiedCode)) { + props.LineBgColor = cfg.CodeUnidentifiedDataColor; + } + + return props; + } + + private void GetBreakpointLineProperties(LineProperties props, int cpuAddress) + { + AddressInfo absAddress = DebugApi.GetAbsoluteAddress(new AddressInfo() { Address = cpuAddress, Type = SnesMemoryType.NecDspMemory }); + foreach(Breakpoint breakpoint in BreakpointManager.Breakpoints) { + if(breakpoint.Matches((uint)cpuAddress, SnesMemoryType.NecDspMemory, CpuType.NecDsp) || (absAddress.Address >= 0 && breakpoint.Matches((uint)absAddress.Address, absAddress.Type, CpuType.NecDsp))) { + SetBreakpointLineProperties(props, breakpoint); + return; + } + } + } + } +} diff --git a/UI/Debugger/Config/DebuggerShortcutsConfig.cs b/UI/Debugger/Config/DebuggerShortcutsConfig.cs index 745d438..27a6ada 100644 --- a/UI/Debugger/Config/DebuggerShortcutsConfig.cs +++ b/UI/Debugger/Config/DebuggerShortcutsConfig.cs @@ -77,6 +77,8 @@ namespace Mesen.GUI.Config public XmlKeys OpenSa1Debugger = Keys.None; [ShortcutName("Open GSU Debugger")] public XmlKeys OpenGsuDebugger = Keys.None; + [ShortcutName("Open DSP Debugger")] + public XmlKeys OpenNecDspDebugger = Keys.None; [ShortcutName("Open Event Viewer")] public XmlKeys OpenEventViewer = Keys.Control | Keys.E; [ShortcutName("Open Memory Tools")] diff --git a/UI/Debugger/Controls/ctrlDisassemblyView.cs b/UI/Debugger/Controls/ctrlDisassemblyView.cs index e3e613f..f911dac 100644 --- a/UI/Debugger/Controls/ctrlDisassemblyView.cs +++ b/UI/Debugger/Controls/ctrlDisassemblyView.cs @@ -345,6 +345,8 @@ namespace Mesen.GUI.Debugger.Controls DebugApi.RefreshDisassembly(CpuType.Cpu); DebugApi.RefreshDisassembly(CpuType.Spc); DebugApi.RefreshDisassembly(CpuType.Sa1); + DebugApi.RefreshDisassembly(CpuType.Gsu); + DebugApi.RefreshDisassembly(CpuType.NecDsp); } _manager.RefreshCode(_inSourceView ? _symbolProvider : null, _inSourceView ? cboSourceFile.SelectedItem as SourceFileInfo : null); diff --git a/UI/Debugger/Controls/ctrlNecDspStatus.Designer.cs b/UI/Debugger/Controls/ctrlNecDspStatus.Designer.cs new file mode 100644 index 0000000..b10b38d --- /dev/null +++ b/UI/Debugger/Controls/ctrlNecDspStatus.Designer.cs @@ -0,0 +1,646 @@ +namespace Mesen.GUI.Debugger.Controls +{ + partial class ctrlNecDspStatus + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.grpNecDsp = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.label16 = new System.Windows.Forms.Label(); + this.txtTR = new System.Windows.Forms.TextBox(); + this.txtRP = new System.Windows.Forms.TextBox(); + this.txtK = new System.Windows.Forms.TextBox(); + this.txtTRB = new System.Windows.Forms.TextBox(); + this.txtDP = new System.Windows.Forms.TextBox(); + this.txtL = new System.Windows.Forms.TextBox(); + this.txtPC = new System.Windows.Forms.TextBox(); + this.txtDR = new System.Windows.Forms.TextBox(); + this.txtM = new System.Windows.Forms.TextBox(); + this.txtSP = new System.Windows.Forms.TextBox(); + this.txtSR = new System.Windows.Forms.TextBox(); + this.txtN = new System.Windows.Forms.TextBox(); + this.label17 = new System.Windows.Forms.Label(); + this.txtA = new System.Windows.Forms.TextBox(); + this.label7 = new System.Windows.Forms.Label(); + this.txtB = new System.Windows.Forms.TextBox(); + this.tlpFlagsA = new System.Windows.Forms.TableLayoutPanel(); + this.chkZeroA = new System.Windows.Forms.CheckBox(); + this.chkCarryA = new System.Windows.Forms.CheckBox(); + this.chkOverflow1A = new System.Windows.Forms.CheckBox(); + this.chkOverflow0A = new System.Windows.Forms.CheckBox(); + this.chkSign0A = new System.Windows.Forms.CheckBox(); + this.chkSign1A = new System.Windows.Forms.CheckBox(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.chkCarryB = new System.Windows.Forms.CheckBox(); + this.chkZeroB = new System.Windows.Forms.CheckBox(); + this.chkOverflow0B = new System.Windows.Forms.CheckBox(); + this.chkOverflow1B = new System.Windows.Forms.CheckBox(); + this.chkSign0B = new System.Windows.Forms.CheckBox(); + this.chkSign1B = new System.Windows.Forms.CheckBox(); + this.grpNecDsp.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.tlpFlagsA.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); + this.SuspendLayout(); + // + // grpNecDsp + // + this.grpNecDsp.Controls.Add(this.tableLayoutPanel1); + this.grpNecDsp.Dock = System.Windows.Forms.DockStyle.Top; + this.grpNecDsp.Location = new System.Drawing.Point(0, 0); + this.grpNecDsp.Name = "grpNecDsp"; + this.grpNecDsp.Size = new System.Drawing.Size(325, 150); + this.grpNecDsp.TabIndex = 0; + this.grpNecDsp.TabStop = false; + this.grpNecDsp.Text = "DSP"; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 8; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.Controls.Add(this.label3, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.label4, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.label5, 2, 0); + this.tableLayoutPanel1.Controls.Add(this.label8, 4, 0); + this.tableLayoutPanel1.Controls.Add(this.label9, 6, 0); + this.tableLayoutPanel1.Controls.Add(this.label10, 2, 1); + this.tableLayoutPanel1.Controls.Add(this.label11, 4, 1); + this.tableLayoutPanel1.Controls.Add(this.label12, 6, 1); + this.tableLayoutPanel1.Controls.Add(this.label13, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.label14, 2, 2); + this.tableLayoutPanel1.Controls.Add(this.label15, 4, 2); + this.tableLayoutPanel1.Controls.Add(this.label16, 6, 2); + this.tableLayoutPanel1.Controls.Add(this.txtTR, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.txtRP, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.txtK, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.txtTRB, 3, 0); + this.tableLayoutPanel1.Controls.Add(this.txtDP, 3, 1); + this.tableLayoutPanel1.Controls.Add(this.txtL, 3, 2); + this.tableLayoutPanel1.Controls.Add(this.txtPC, 5, 0); + this.tableLayoutPanel1.Controls.Add(this.txtDR, 5, 1); + this.tableLayoutPanel1.Controls.Add(this.txtM, 5, 2); + this.tableLayoutPanel1.Controls.Add(this.txtSP, 7, 0); + this.tableLayoutPanel1.Controls.Add(this.txtSR, 7, 1); + this.tableLayoutPanel1.Controls.Add(this.txtN, 7, 2); + this.tableLayoutPanel1.Controls.Add(this.label17, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.txtA, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.label7, 0, 4); + this.tableLayoutPanel1.Controls.Add(this.txtB, 1, 4); + this.tableLayoutPanel1.Controls.Add(this.tlpFlagsA, 2, 3); + this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 2, 4); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 16); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 9; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(319, 131); + this.tableLayoutPanel1.TabIndex = 0; + // + // label3 + // + this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(3, 6); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(25, 13); + this.label3.TabIndex = 17; + this.label3.Text = "TR:"; + // + // label4 + // + this.label4.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(3, 32); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(25, 13); + this.label4.TabIndex = 18; + this.label4.Text = "RP:"; + // + // label5 + // + this.label5.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(80, 6); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(32, 13); + this.label5.TabIndex = 19; + this.label5.Text = "TRB:"; + // + // label8 + // + this.label8.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(164, 6); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(24, 13); + this.label8.TabIndex = 20; + this.label8.Text = "PC:"; + // + // label9 + // + this.label9.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(242, 6); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(24, 13); + this.label9.TabIndex = 21; + this.label9.Text = "SP:"; + // + // label10 + // + this.label10.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(80, 32); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(25, 13); + this.label10.TabIndex = 22; + this.label10.Text = "DP:"; + // + // label11 + // + this.label11.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(164, 32); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(26, 13); + this.label11.TabIndex = 23; + this.label11.Text = "DR:"; + // + // label12 + // + this.label12.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(242, 32); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(25, 13); + this.label12.TabIndex = 24; + this.label12.Text = "SR:"; + // + // label13 + // + this.label13.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(3, 58); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(17, 13); + this.label13.TabIndex = 25; + this.label13.Text = "K:"; + // + // label14 + // + this.label14.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(80, 58); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(16, 13); + this.label14.TabIndex = 26; + this.label14.Text = "L:"; + // + // label15 + // + this.label15.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point(164, 58); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(19, 13); + this.label15.TabIndex = 27; + this.label15.Text = "M:"; + // + // label16 + // + this.label16.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(242, 58); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(18, 13); + this.label16.TabIndex = 28; + this.label16.Text = "N:"; + // + // txtTR + // + this.txtTR.Location = new System.Drawing.Point(34, 3); + this.txtTR.Name = "txtTR"; + this.txtTR.Size = new System.Drawing.Size(40, 20); + this.txtTR.TabIndex = 29; + this.txtTR.Text = "DDDD"; + // + // txtRP + // + this.txtRP.Location = new System.Drawing.Point(34, 29); + this.txtRP.Name = "txtRP"; + this.txtRP.Size = new System.Drawing.Size(40, 20); + this.txtRP.TabIndex = 30; + this.txtRP.Text = "DDDD"; + // + // txtK + // + this.txtK.Location = new System.Drawing.Point(34, 55); + this.txtK.Name = "txtK"; + this.txtK.Size = new System.Drawing.Size(40, 20); + this.txtK.TabIndex = 31; + this.txtK.Text = "DDDD"; + // + // txtTRB + // + this.txtTRB.Location = new System.Drawing.Point(118, 3); + this.txtTRB.Name = "txtTRB"; + this.txtTRB.Size = new System.Drawing.Size(40, 20); + this.txtTRB.TabIndex = 32; + this.txtTRB.Text = "DDDD"; + // + // txtDP + // + this.txtDP.Location = new System.Drawing.Point(118, 29); + this.txtDP.Name = "txtDP"; + this.txtDP.Size = new System.Drawing.Size(40, 20); + this.txtDP.TabIndex = 33; + this.txtDP.Text = "DDDD"; + // + // txtL + // + this.txtL.Location = new System.Drawing.Point(118, 55); + this.txtL.Name = "txtL"; + this.txtL.Size = new System.Drawing.Size(40, 20); + this.txtL.TabIndex = 34; + this.txtL.Text = "DDDD"; + // + // txtPC + // + this.txtPC.Location = new System.Drawing.Point(196, 3); + this.txtPC.Name = "txtPC"; + this.txtPC.Size = new System.Drawing.Size(40, 20); + this.txtPC.TabIndex = 35; + this.txtPC.Text = "DDDD"; + // + // txtDR + // + this.txtDR.Location = new System.Drawing.Point(196, 29); + this.txtDR.Name = "txtDR"; + this.txtDR.Size = new System.Drawing.Size(40, 20); + this.txtDR.TabIndex = 36; + this.txtDR.Text = "DDDD"; + // + // txtM + // + this.txtM.Location = new System.Drawing.Point(196, 55); + this.txtM.Name = "txtM"; + this.txtM.Size = new System.Drawing.Size(40, 20); + this.txtM.TabIndex = 37; + this.txtM.Text = "DDDD"; + // + // txtSP + // + this.txtSP.Location = new System.Drawing.Point(273, 3); + this.txtSP.Name = "txtSP"; + this.txtSP.Size = new System.Drawing.Size(40, 20); + this.txtSP.TabIndex = 38; + this.txtSP.Text = "DDDD"; + // + // txtSR + // + this.txtSR.Location = new System.Drawing.Point(273, 29); + this.txtSR.Name = "txtSR"; + this.txtSR.Size = new System.Drawing.Size(40, 20); + this.txtSR.TabIndex = 39; + this.txtSR.Text = "DDDD"; + // + // txtN + // + this.txtN.Location = new System.Drawing.Point(273, 55); + this.txtN.Name = "txtN"; + this.txtN.Size = new System.Drawing.Size(40, 20); + this.txtN.TabIndex = 40; + this.txtN.Text = "DDDD"; + // + // label17 + // + this.label17.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label17.AutoSize = true; + this.label17.Location = new System.Drawing.Point(3, 84); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(17, 13); + this.label17.TabIndex = 41; + this.label17.Text = "A:"; + // + // txtA + // + this.txtA.Location = new System.Drawing.Point(34, 81); + this.txtA.Name = "txtA"; + this.txtA.Size = new System.Drawing.Size(40, 20); + this.txtA.TabIndex = 43; + // + // label7 + // + this.label7.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(3, 110); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(17, 13); + this.label7.TabIndex = 14; + this.label7.Text = "B:"; + // + // txtB + // + this.txtB.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.txtB.Location = new System.Drawing.Point(34, 107); + this.txtB.Name = "txtB"; + this.txtB.Size = new System.Drawing.Size(40, 20); + this.txtB.TabIndex = 15; + this.txtB.Text = "DD"; + // + // tlpFlagsA + // + this.tlpFlagsA.ColumnCount = 6; + this.tableLayoutPanel1.SetColumnSpan(this.tlpFlagsA, 6); + this.tlpFlagsA.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tlpFlagsA.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tlpFlagsA.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tlpFlagsA.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tlpFlagsA.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tlpFlagsA.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tlpFlagsA.Controls.Add(this.chkCarryA, 0, 0); + this.tlpFlagsA.Controls.Add(this.chkZeroA, 1, 0); + this.tlpFlagsA.Controls.Add(this.chkOverflow0A, 2, 0); + this.tlpFlagsA.Controls.Add(this.chkOverflow1A, 3, 0); + this.tlpFlagsA.Controls.Add(this.chkSign0A, 4, 0); + this.tlpFlagsA.Controls.Add(this.chkSign1A, 5, 0); + this.tlpFlagsA.Dock = System.Windows.Forms.DockStyle.Fill; + this.tlpFlagsA.Location = new System.Drawing.Point(80, 81); + this.tlpFlagsA.Name = "tlpFlagsA"; + this.tlpFlagsA.RowCount = 1; + this.tlpFlagsA.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tlpFlagsA.Size = new System.Drawing.Size(236, 20); + this.tlpFlagsA.TabIndex = 16; + // + // chkZeroA + // + this.chkZeroA.AutoSize = true; + this.chkZeroA.Location = new System.Drawing.Point(33, 3); + this.chkZeroA.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.chkZeroA.Name = "chkZeroA"; + this.chkZeroA.Size = new System.Drawing.Size(33, 17); + this.chkZeroA.TabIndex = 21; + this.chkZeroA.Text = "Z"; + this.chkZeroA.UseVisualStyleBackColor = true; + // + // chkCarryA + // + this.chkCarryA.AutoSize = true; + this.chkCarryA.Location = new System.Drawing.Point(0, 3); + this.chkCarryA.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.chkCarryA.Name = "chkCarryA"; + this.chkCarryA.Size = new System.Drawing.Size(33, 17); + this.chkCarryA.TabIndex = 23; + this.chkCarryA.Text = "C"; + this.chkCarryA.UseVisualStyleBackColor = true; + // + // chkOverflow1A + // + this.chkOverflow1A.AutoSize = true; + this.chkOverflow1A.Location = new System.Drawing.Point(105, 3); + this.chkOverflow1A.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.chkOverflow1A.Name = "chkOverflow1A"; + this.chkOverflow1A.Size = new System.Drawing.Size(39, 17); + this.chkOverflow1A.TabIndex = 17; + this.chkOverflow1A.Text = "V1"; + this.chkOverflow1A.UseVisualStyleBackColor = true; + // + // chkOverflow0A + // + this.chkOverflow0A.AutoSize = true; + this.chkOverflow0A.Location = new System.Drawing.Point(66, 3); + this.chkOverflow0A.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.chkOverflow0A.Name = "chkOverflow0A"; + this.chkOverflow0A.Size = new System.Drawing.Size(39, 17); + this.chkOverflow0A.TabIndex = 20; + this.chkOverflow0A.Text = "V0"; + this.chkOverflow0A.UseVisualStyleBackColor = true; + // + // chkSign0A + // + this.chkSign0A.AutoSize = true; + this.chkSign0A.Location = new System.Drawing.Point(144, 3); + this.chkSign0A.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.chkSign0A.Name = "chkSign0A"; + this.chkSign0A.Size = new System.Drawing.Size(39, 17); + this.chkSign0A.TabIndex = 24; + this.chkSign0A.Text = "S0"; + this.chkSign0A.UseVisualStyleBackColor = true; + // + // chkSign1A + // + this.chkSign1A.AutoSize = true; + this.chkSign1A.Location = new System.Drawing.Point(183, 3); + this.chkSign1A.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.chkSign1A.Name = "chkSign1A"; + this.chkSign1A.Size = new System.Drawing.Size(39, 17); + this.chkSign1A.TabIndex = 25; + this.chkSign1A.Text = "S1"; + this.chkSign1A.UseVisualStyleBackColor = true; + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 6; + this.tableLayoutPanel1.SetColumnSpan(this.tableLayoutPanel2, 6); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.Controls.Add(this.chkCarryB, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.chkZeroB, 1, 0); + this.tableLayoutPanel2.Controls.Add(this.chkOverflow0B, 2, 0); + this.tableLayoutPanel2.Controls.Add(this.chkOverflow1B, 3, 0); + this.tableLayoutPanel2.Controls.Add(this.chkSign0B, 4, 0); + this.tableLayoutPanel2.Controls.Add(this.chkSign1B, 5, 0); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Location = new System.Drawing.Point(80, 107); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 1; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel2.Size = new System.Drawing.Size(236, 20); + this.tableLayoutPanel2.TabIndex = 44; + // + // chkCarryB + // + this.chkCarryB.AutoSize = true; + this.chkCarryB.Location = new System.Drawing.Point(0, 3); + this.chkCarryB.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.chkCarryB.Name = "chkCarryB"; + this.chkCarryB.Size = new System.Drawing.Size(33, 17); + this.chkCarryB.TabIndex = 23; + this.chkCarryB.Text = "C"; + this.chkCarryB.UseVisualStyleBackColor = true; + // + // chkZeroB + // + this.chkZeroB.AutoSize = true; + this.chkZeroB.Location = new System.Drawing.Point(33, 3); + this.chkZeroB.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.chkZeroB.Name = "chkZeroB"; + this.chkZeroB.Size = new System.Drawing.Size(33, 17); + this.chkZeroB.TabIndex = 21; + this.chkZeroB.Text = "Z"; + this.chkZeroB.UseVisualStyleBackColor = true; + // + // chkOverflow0B + // + this.chkOverflow0B.AutoSize = true; + this.chkOverflow0B.Location = new System.Drawing.Point(66, 3); + this.chkOverflow0B.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.chkOverflow0B.Name = "chkOverflow0B"; + this.chkOverflow0B.Size = new System.Drawing.Size(39, 17); + this.chkOverflow0B.TabIndex = 20; + this.chkOverflow0B.Text = "V0"; + this.chkOverflow0B.UseVisualStyleBackColor = true; + // + // chkOverflow1B + // + this.chkOverflow1B.AutoSize = true; + this.chkOverflow1B.Location = new System.Drawing.Point(105, 3); + this.chkOverflow1B.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.chkOverflow1B.Name = "chkOverflow1B"; + this.chkOverflow1B.Size = new System.Drawing.Size(39, 17); + this.chkOverflow1B.TabIndex = 17; + this.chkOverflow1B.Text = "V1"; + this.chkOverflow1B.UseVisualStyleBackColor = true; + // + // chkSign0B + // + this.chkSign0B.AutoSize = true; + this.chkSign0B.Location = new System.Drawing.Point(144, 3); + this.chkSign0B.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.chkSign0B.Name = "chkSign0B"; + this.chkSign0B.Size = new System.Drawing.Size(39, 17); + this.chkSign0B.TabIndex = 24; + this.chkSign0B.Text = "S0"; + this.chkSign0B.UseVisualStyleBackColor = true; + // + // chkSign1B + // + this.chkSign1B.AutoSize = true; + this.chkSign1B.Location = new System.Drawing.Point(183, 3); + this.chkSign1B.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); + this.chkSign1B.Name = "chkSign1B"; + this.chkSign1B.Size = new System.Drawing.Size(39, 17); + this.chkSign1B.TabIndex = 25; + this.chkSign1B.Text = "S1"; + this.chkSign1B.UseVisualStyleBackColor = true; + // + // ctrlNecDspStatus + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.grpNecDsp); + this.Name = "ctrlNecDspStatus"; + this.Size = new System.Drawing.Size(325, 150); + this.grpNecDsp.ResumeLayout(false); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.tlpFlagsA.ResumeLayout(false); + this.tlpFlagsA.PerformLayout(); + this.tableLayoutPanel2.ResumeLayout(false); + this.tableLayoutPanel2.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox grpNecDsp; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.TextBox txtB; + private System.Windows.Forms.TableLayoutPanel tlpFlagsA; + private System.Windows.Forms.CheckBox chkSign0A; + private System.Windows.Forms.CheckBox chkCarryA; + private System.Windows.Forms.CheckBox chkZeroA; + private System.Windows.Forms.CheckBox chkOverflow1A; + private System.Windows.Forms.CheckBox chkOverflow0A; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.TextBox txtTR; + private System.Windows.Forms.TextBox txtRP; + private System.Windows.Forms.TextBox txtK; + private System.Windows.Forms.TextBox txtTRB; + private System.Windows.Forms.TextBox txtDP; + private System.Windows.Forms.TextBox txtL; + private System.Windows.Forms.TextBox txtPC; + private System.Windows.Forms.TextBox txtDR; + private System.Windows.Forms.TextBox txtM; + private System.Windows.Forms.TextBox txtSP; + private System.Windows.Forms.TextBox txtSR; + private System.Windows.Forms.TextBox txtN; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.TextBox txtA; + private System.Windows.Forms.CheckBox chkSign1A; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.CheckBox chkCarryB; + private System.Windows.Forms.CheckBox chkZeroB; + private System.Windows.Forms.CheckBox chkOverflow0B; + private System.Windows.Forms.CheckBox chkOverflow1B; + private System.Windows.Forms.CheckBox chkSign0B; + private System.Windows.Forms.CheckBox chkSign1B; + } +} diff --git a/UI/Debugger/Controls/ctrlNecDspStatus.cs b/UI/Debugger/Controls/ctrlNecDspStatus.cs new file mode 100644 index 0000000..dcb8219 --- /dev/null +++ b/UI/Debugger/Controls/ctrlNecDspStatus.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Mesen.GUI.Controls; +using Mesen.GUI.Forms; + +namespace Mesen.GUI.Debugger.Controls +{ + public partial class ctrlNecDspStatus : BaseControl + { + public ctrlNecDspStatus() + { + InitializeComponent(); + if(IsDesignMode) { + return; + } + } + + public void UpdateStatus(NecDspState state) + { + txtTR.Text = state.TR.ToString("X4"); + txtTRB.Text = state.TRB.ToString("X4"); + txtPC.Text = state.PC.ToString("X4"); + txtSP.Text = state.SP.ToString("X2"); + txtRP.Text = state.RP.ToString("X4"); + txtDP.Text = state.DP.ToString("X4"); + txtDR.Text = state.DR.ToString("X4"); + txtSR.Text = state.SR.ToString("X4"); + txtK.Text = state.K.ToString("X4"); + txtL.Text = state.L.ToString("X4"); + txtM.Text = state.M.ToString("X4"); + txtN.Text = state.N.ToString("X4"); + txtA.Text = state.A.ToString("X4"); + txtB.Text = state.B.ToString("X4"); + + chkCarryA.Checked = state.FlagsA.Carry; + chkZeroA.Checked = state.FlagsA.Zero; + chkOverflow0A.Checked = state.FlagsA.Overflow0; + chkOverflow1A.Checked = state.FlagsA.Overflow1; + chkSign0A.Checked = state.FlagsA.Sign0; + chkSign1A.Checked = state.FlagsA.Sign1; + + chkCarryB.Checked = state.FlagsB.Carry; + chkZeroB.Checked = state.FlagsB.Zero; + chkOverflow0B.Checked = state.FlagsB.Overflow0; + chkOverflow1B.Checked = state.FlagsB.Overflow1; + chkSign0B.Checked = state.FlagsB.Sign0; + chkSign1B.Checked = state.FlagsB.Sign1; + } + } +} diff --git a/UI/Debugger/Controls/ctrlNecDspStatus.resx b/UI/Debugger/Controls/ctrlNecDspStatus.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UI/Debugger/Controls/ctrlNecDspStatus.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UI/Debugger/Controls/ctrlSpcStatus.cs b/UI/Debugger/Controls/ctrlSpcStatus.cs index 11e2756..2f9792a 100644 --- a/UI/Debugger/Controls/ctrlSpcStatus.cs +++ b/UI/Debugger/Controls/ctrlSpcStatus.cs @@ -15,7 +15,7 @@ namespace Mesen.GUI.Debugger.Controls public partial class ctrlSpcStatus : BaseControl { private EntityBinder _binder = new EntityBinder(); - private DebugState _lastState; + private SpcState _lastState; public ctrlSpcStatus() { @@ -33,11 +33,11 @@ namespace Mesen.GUI.Debugger.Controls _binder.AddBinding(nameof(SpcState.PS), txtP); } - public void UpdateStatus(DebugState state) + public void UpdateStatus(SpcState state) { _lastState = state; - _binder.Entity = state.Spc; + _binder.Entity = state; _binder.UpdateUI(); UpdateCpuFlags(); @@ -46,7 +46,7 @@ namespace Mesen.GUI.Debugger.Controls private void UpdateCpuFlags() { - SpcFlags flags = _lastState.Spc.PS; + SpcFlags flags = _lastState.PS; chkNegative.Checked = flags.HasFlag(SpcFlags.Negative); chkOverflow.Checked = flags.HasFlag(SpcFlags.Overflow); chkPage.Checked = flags.HasFlag(SpcFlags.DirectPage); @@ -60,7 +60,7 @@ namespace Mesen.GUI.Debugger.Controls private void UpdateStack() { StringBuilder sb = new StringBuilder(); - for(UInt32 i = (uint)_lastState.Spc.SP + 1; (i & 0xFF) != 0; i++) { + for(UInt32 i = (uint)_lastState.SP + 1; (i & 0xFF) != 0; i++) { sb.Append("$"); sb.Append(DebugApi.GetMemoryValue(SnesMemoryType.SpcMemory, 0x100 | i).ToString("X2")); sb.Append(", "); diff --git a/UI/Debugger/DebugWindowManager.cs b/UI/Debugger/DebugWindowManager.cs index 4f6f856..2daf0d2 100644 --- a/UI/Debugger/DebugWindowManager.cs +++ b/UI/Debugger/DebugWindowManager.cs @@ -30,6 +30,7 @@ namespace Mesen.GUI.Debugger case DebugWindow.SpcDebugger: frm = new frmDebugger(CpuType.Spc); frm.Icon = Properties.Resources.SpcDebugger; break; case DebugWindow.Sa1Debugger: frm = new frmDebugger(CpuType.Sa1); frm.Icon = Properties.Resources.Sa1Debugger; break; case DebugWindow.GsuDebugger: frm = new frmDebugger(CpuType.Gsu); frm.Icon = Properties.Resources.GsuDebugger; break; + case DebugWindow.NecDspDebugger: frm = new frmDebugger(CpuType.NecDsp); frm.Icon = Properties.Resources.NecDspDebugger; break; case DebugWindow.TraceLogger: frm = new frmTraceLogger(); frm.Icon = Properties.Resources.LogWindow; break; case DebugWindow.MemoryTools: frm = new frmMemoryTools(); frm.Icon = Properties.Resources.CheatCode; break; case DebugWindow.TileViewer: frm = new frmTileViewer(); frm.Icon = Properties.Resources.VerticalLayout; break; @@ -85,6 +86,7 @@ namespace Mesen.GUI.Debugger switch(type) { case CpuType.Cpu: return (frmDebugger)OpenDebugWindow(DebugWindow.Debugger); case CpuType.Spc: return (frmDebugger)OpenDebugWindow(DebugWindow.SpcDebugger); + case CpuType.NecDsp: return (frmDebugger)OpenDebugWindow(DebugWindow.NecDspDebugger); case CpuType.Sa1: return (frmDebugger)OpenDebugWindow(DebugWindow.Sa1Debugger); case CpuType.Gsu: return (frmDebugger)OpenDebugWindow(DebugWindow.GsuDebugger); } @@ -96,6 +98,7 @@ namespace Mesen.GUI.Debugger switch(type) { case CpuType.Cpu: return (frmDebugger)GetExistingSingleInstanceWindow(DebugWindow.Debugger); case CpuType.Spc: return (frmDebugger)GetExistingSingleInstanceWindow(DebugWindow.SpcDebugger); + case CpuType.NecDsp: return (frmDebugger)GetExistingSingleInstanceWindow(DebugWindow.NecDspDebugger); case CpuType.Sa1: return (frmDebugger)GetExistingSingleInstanceWindow(DebugWindow.Sa1Debugger); case CpuType.Gsu: return (frmDebugger)GetExistingSingleInstanceWindow(DebugWindow.GsuDebugger); } @@ -144,6 +147,7 @@ namespace Mesen.GUI.Debugger case DebugWindow.SpcDebugger: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmDebugger) && ((frmDebugger)form).CpuType == CpuType.Spc); case DebugWindow.Sa1Debugger: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmDebugger) && ((frmDebugger)form).CpuType == CpuType.Sa1); case DebugWindow.GsuDebugger: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmDebugger) && ((frmDebugger)form).CpuType == CpuType.Gsu); + case DebugWindow.NecDspDebugger: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmDebugger) && ((frmDebugger)form).CpuType == CpuType.NecDsp); case DebugWindow.TraceLogger: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmTraceLogger)); case DebugWindow.EventViewer: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmEventViewer)); case DebugWindow.Profiler: return _openedWindows.ToList().Find((form) => form.GetType() == typeof(frmProfiler)); @@ -185,6 +189,7 @@ namespace Mesen.GUI.Debugger SpcDebugger, Sa1Debugger, GsuDebugger, + NecDspDebugger, MemoryTools, TraceLogger, TileViewer, diff --git a/UI/Debugger/Labels/CodeLabel.cs b/UI/Debugger/Labels/CodeLabel.cs index a87c81e..6b5cf75 100644 --- a/UI/Debugger/Labels/CodeLabel.cs +++ b/UI/Debugger/Labels/CodeLabel.cs @@ -29,6 +29,7 @@ namespace Mesen.GUI.Debugger.Labels case SnesMemoryType.SpcRom: sb.Append("SPCROM:"); break; case SnesMemoryType.BsxPsRam: sb.Append("PSRAM:"); break; case SnesMemoryType.BsxMemoryPack: sb.Append("MPACK:"); break; + case SnesMemoryType.DspProgramRom: sb.Append("DSPPRG:"); break; } sb.Append(Address.ToString("X4")); @@ -64,6 +65,7 @@ namespace Mesen.GUI.Debugger.Labels case "SPCROM": type = SnesMemoryType.SpcRom; break; case "PSRAM": type = SnesMemoryType.BsxPsRam; break; case "MPACK": type = SnesMemoryType.BsxMemoryPack; break; + case "DSPPRG": type = SnesMemoryType.DspProgramRom; break; default: return null; } diff --git a/UI/Debugger/Labels/LabelManager.cs b/UI/Debugger/Labels/LabelManager.cs index 4aada45..031533e 100644 --- a/UI/Debugger/Labels/LabelManager.cs +++ b/UI/Debugger/Labels/LabelManager.cs @@ -86,6 +86,7 @@ namespace Mesen.GUI.Debugger.Labels case SnesMemoryType.GsuWorkRam: return address | ((ulong)8 << 32); case SnesMemoryType.BsxPsRam: return address | ((ulong)9 << 32); case SnesMemoryType.BsxMemoryPack: return address | ((ulong)10 << 32); + case SnesMemoryType.DspProgramRom: return address | ((ulong)11 << 32); } throw new Exception("Invalid type"); } @@ -184,6 +185,8 @@ namespace Mesen.GUI.Debugger.Labels { if(label.MemoryType.ToCpuType() == CpuType.Spc) { DebugApi.RefreshDisassembly(CpuType.Spc); + } else if(label.MemoryType.ToCpuType() == CpuType.NecDsp) { + DebugApi.RefreshDisassembly(CpuType.NecDsp); } else { DebugApi.RefreshDisassembly(CpuType.Cpu); DebugApi.RefreshDisassembly(CpuType.Sa1); diff --git a/UI/Debugger/Labels/ctrlLabelList.cs b/UI/Debugger/Labels/ctrlLabelList.cs index 7b443a7..c05c4e8 100644 --- a/UI/Debugger/Labels/ctrlLabelList.cs +++ b/UI/Debugger/Labels/ctrlLabelList.cs @@ -136,6 +136,7 @@ namespace Mesen.GUI.Debugger.Controls case SnesMemoryType.Sa1InternalRam: prefix = "IRAM: $"; break; case SnesMemoryType.BsxPsRam: prefix = "PSRAM: $"; break; case SnesMemoryType.BsxMemoryPack: prefix = "MPACK: $"; break; + case SnesMemoryType.DspProgramRom: prefix = "DSPPRG: $"; break; default: throw new Exception("Unsupported type"); } int relAddress = label.GetRelativeAddress(_cpuType).Address; @@ -238,9 +239,23 @@ namespace Mesen.GUI.Debugger.Controls private void mnuAdd_Click(object sender, EventArgs e) { + SnesMemoryType defaultMemType = SnesMemoryType.PrgRom; + switch(_cpuType) { + case CpuType.Cpu: + case CpuType.Sa1: + case CpuType.Gsu: + defaultMemType = SnesMemoryType.PrgRom; + break; + + case CpuType.Spc: defaultMemType = SnesMemoryType.SpcRam; break; + case CpuType.NecDsp: defaultMemType = SnesMemoryType.DspProgramRom; break; + + default: throw new Exception("Unsupported CPU type"); + } + CodeLabel newLabel = new CodeLabel() { Address = 0, - MemoryType = _cpuType == CpuType.Spc ? SnesMemoryType.SpcRam : SnesMemoryType.PrgRom, + MemoryType = defaultMemType, Label = "", Comment = "" }; diff --git a/UI/Debugger/Labels/frmEditLabel.cs b/UI/Debugger/Labels/frmEditLabel.cs index 9184fd4..59c5fc0 100644 --- a/UI/Debugger/Labels/frmEditLabel.cs +++ b/UI/Debugger/Labels/frmEditLabel.cs @@ -55,6 +55,8 @@ namespace Mesen.GUI.Debugger } else if(cpuType == CpuType.Spc) { cboType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.SpcRam)); cboType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.SpcRom)); + } else if(cpuType == CpuType.NecDsp) { + cboType.Items.Add(ResourceHelper.GetEnumText(SnesMemoryType.DspProgramRom)); } } diff --git a/UI/Debugger/Workspace/DebugWorkspace.cs b/UI/Debugger/Workspace/DebugWorkspace.cs index 13c4223..8372ed2 100644 --- a/UI/Debugger/Workspace/DebugWorkspace.cs +++ b/UI/Debugger/Workspace/DebugWorkspace.cs @@ -19,8 +19,10 @@ namespace Mesen.GUI.Debugger.Workspace public List SpcWatchValues = new List(); public List Sa1WatchValues = new List(); public List GsuWatchValues = new List(); + public List NecDspWatchValues = new List(); public List CpuLabels = new List(); public List SpcLabels = new List(); + public List NecDspLabels = new List(); public List TblMappings = null; private string _filePath; diff --git a/UI/Debugger/Workspace/DebugWorkspaceManager.cs b/UI/Debugger/Workspace/DebugWorkspaceManager.cs index c117711..b8c7f5b 100644 --- a/UI/Debugger/Workspace/DebugWorkspaceManager.cs +++ b/UI/Debugger/Workspace/DebugWorkspaceManager.cs @@ -27,9 +27,11 @@ namespace Mesen.GUI.Debugger.Workspace _workspace.SpcWatchValues = new List(WatchManager.GetWatchManager(CpuType.Spc).WatchEntries); _workspace.Sa1WatchValues = new List(WatchManager.GetWatchManager(CpuType.Sa1).WatchEntries); _workspace.GsuWatchValues = new List(WatchManager.GetWatchManager(CpuType.Gsu).WatchEntries); + _workspace.NecDspWatchValues = new List(WatchManager.GetWatchManager(CpuType.NecDsp).WatchEntries); _workspace.Breakpoints = new List(BreakpointManager.Breakpoints); _workspace.CpuLabels = new List(LabelManager.GetLabels(CpuType.Cpu)); _workspace.SpcLabels = new List(LabelManager.GetLabels(CpuType.Spc)); + _workspace.NecDspLabels = new List(LabelManager.GetLabels(CpuType.NecDsp)); _workspace.Save(); } } @@ -49,12 +51,15 @@ namespace Mesen.GUI.Debugger.Workspace _workspace.SpcWatchValues = new List(); _workspace.Sa1WatchValues = new List(); _workspace.GsuWatchValues = new List(); + _workspace.NecDspWatchValues = new List(); _workspace.CpuLabels = new List(); _workspace.SpcLabels = new List(); + _workspace.NecDspLabels = new List(); WatchManager.GetWatchManager(CpuType.Cpu).WatchEntries = _workspace.WatchValues; WatchManager.GetWatchManager(CpuType.Spc).WatchEntries = _workspace.SpcWatchValues; WatchManager.GetWatchManager(CpuType.Sa1).WatchEntries = _workspace.Sa1WatchValues; WatchManager.GetWatchManager(CpuType.Gsu).WatchEntries = _workspace.GsuWatchValues; + WatchManager.GetWatchManager(CpuType.NecDsp).WatchEntries = _workspace.NecDspWatchValues; BreakpointManager.SetBreakpoints(_workspace.Breakpoints); LabelManager.SetDefaultLabels(); LabelManager.RefreshLabels(); @@ -68,6 +73,7 @@ namespace Mesen.GUI.Debugger.Workspace if(_workspace != null) { _workspace.CpuLabels = new List(); _workspace.SpcLabels = new List(); + _workspace.NecDspLabels = new List(); LabelManager.ResetLabels(); LabelManager.SetDefaultLabels(); LabelManager.RefreshLabels(); @@ -89,10 +95,12 @@ namespace Mesen.GUI.Debugger.Workspace WatchManager.GetWatchManager(CpuType.Spc).WatchEntries = _workspace.SpcWatchValues; WatchManager.GetWatchManager(CpuType.Sa1).WatchEntries = _workspace.Sa1WatchValues; WatchManager.GetWatchManager(CpuType.Gsu).WatchEntries = _workspace.GsuWatchValues; + WatchManager.GetWatchManager(CpuType.NecDsp).WatchEntries = _workspace.NecDspWatchValues; LabelManager.ResetLabels(); LabelManager.SetLabels(_workspace.CpuLabels); LabelManager.SetLabels(_workspace.SpcLabels); + LabelManager.SetLabels(_workspace.NecDspLabels); LabelManager.SetDefaultLabels(); ImportDbgFile(); diff --git a/UI/Debugger/frmDbgPreferences.cs b/UI/Debugger/frmDbgPreferences.cs index b6fcc6c..fd446e3 100644 --- a/UI/Debugger/frmDbgPreferences.cs +++ b/UI/Debugger/frmDbgPreferences.cs @@ -61,6 +61,7 @@ namespace Mesen.GUI.Debugger GetMember(nameof(DebuggerShortcutsConfig.OpenSpcDebugger)), GetMember(nameof(DebuggerShortcutsConfig.OpenSa1Debugger)), GetMember(nameof(DebuggerShortcutsConfig.OpenGsuDebugger)), + GetMember(nameof(DebuggerShortcutsConfig.OpenNecDspDebugger)), }; ctrlDbgShortcutsMemoryViewer.Shortcuts = new FieldInfo[] { diff --git a/UI/Debugger/frmDebugger.Designer.cs b/UI/Debugger/frmDebugger.Designer.cs index aac6f40..7efd5bd 100644 --- a/UI/Debugger/frmDebugger.Designer.cs +++ b/UI/Debugger/frmDebugger.Designer.cs @@ -109,7 +109,7 @@ this.mnuBreakOptions = new System.Windows.Forms.ToolStripMenuItem(); this.mnuBreakOnPowerCycleReset = new System.Windows.Forms.ToolStripMenuItem(); this.mnuBreakOnOpen = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem12 = new System.Windows.Forms.ToolStripSeparator(); + this.sepBrkCopStpWdm = new System.Windows.Forms.ToolStripSeparator(); this.mnuBreakOnBrk = new System.Windows.Forms.ToolStripMenuItem(); this.mnuBreakOnCop = new System.Windows.Forms.ToolStripMenuItem(); this.mnuBreakOnStp = new System.Windows.Forms.ToolStripMenuItem(); @@ -130,12 +130,9 @@ this.mnuConfigureColors = new System.Windows.Forms.ToolStripMenuItem(); this.mnuPreferences = new System.Windows.Forms.ToolStripMenuItem(); this.ctrlSplitContainer = new Mesen.GUI.Controls.ctrlSplitContainer(); - this.panel1 = new System.Windows.Forms.Panel(); + this.pnlStatus = new System.Windows.Forms.Panel(); this.ctrlLabelList = new Mesen.GUI.Debugger.Controls.ctrlLabelList(); this.ctrlPpuStatus = new Mesen.GUI.Debugger.Controls.ctrlPpuStatus(); - this.ctrlGsuStatus = new Mesen.GUI.Debugger.Controls.ctrlGsuStatus(); - this.ctrlSpcStatus = new Mesen.GUI.Debugger.Controls.ctrlSpcStatus(); - this.ctrlCpuStatus = new Mesen.GUI.Debugger.Controls.ctrlCpuStatus(); this.tlpBottomPanel = new System.Windows.Forms.TableLayoutPanel(); this.grpWatch = new System.Windows.Forms.GroupBox(); this.picWatchHelp = new System.Windows.Forms.PictureBox(); @@ -150,7 +147,7 @@ this.ctrlSplitContainer.Panel1.SuspendLayout(); this.ctrlSplitContainer.Panel2.SuspendLayout(); this.ctrlSplitContainer.SuspendLayout(); - this.panel1.SuspendLayout(); + this.pnlStatus.SuspendLayout(); this.tlpBottomPanel.SuspendLayout(); this.grpWatch.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picWatchHelp)).BeginInit(); @@ -169,10 +166,10 @@ // ctrlMesenMenuStrip1 // this.ctrlMesenMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem, - this.debugToolStripMenuItem, - this.searchToolStripMenuItem, - this.optionsToolStripMenuItem}); + this.fileToolStripMenuItem, + this.debugToolStripMenuItem, + this.searchToolStripMenuItem, + this.optionsToolStripMenuItem}); this.ctrlMesenMenuStrip1.Location = new System.Drawing.Point(0, 0); this.ctrlMesenMenuStrip1.Name = "ctrlMesenMenuStrip1"; this.ctrlMesenMenuStrip1.Size = new System.Drawing.Size(832, 24); @@ -182,16 +179,16 @@ // fileToolStripMenuItem // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuReloadRom, - this.toolStripMenuItem16, - this.mnuSaveRomAs, - this.mnuSaveAsIps, - this.toolStripMenuItem14, - this.importExportToolStripMenuItem, - this.toolStripMenuItem7, - this.codeDataLoggerToolStripMenuItem, - this.toolStripMenuItem13, - this.mnuExit}); + this.mnuReloadRom, + this.toolStripMenuItem16, + this.mnuSaveRomAs, + this.mnuSaveAsIps, + this.toolStripMenuItem14, + this.importExportToolStripMenuItem, + this.toolStripMenuItem7, + this.codeDataLoggerToolStripMenuItem, + this.toolStripMenuItem13, + this.mnuExit}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); this.fileToolStripMenuItem.Text = "File"; @@ -230,10 +227,10 @@ // importExportToolStripMenuItem // this.importExportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuDbgIntegrationSettings, - this.toolStripMenuItem15, - this.mnuImportLabels, - this.mnuExportLabels}); + this.mnuDbgIntegrationSettings, + this.toolStripMenuItem15, + this.mnuImportLabels, + this.mnuExportLabels}); this.importExportToolStripMenuItem.Image = global::Mesen.GUI.Properties.Resources.Import; this.importExportToolStripMenuItem.Name = "importExportToolStripMenuItem"; this.importExportToolStripMenuItem.Size = new System.Drawing.Size(201, 22); @@ -276,9 +273,9 @@ // codeDataLoggerToolStripMenuItem // this.codeDataLoggerToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuResetCdlLog, - this.toolStripSeparator1, - this.mnuCdlGenerateRom}); + this.mnuResetCdlLog, + this.toolStripSeparator1, + this.mnuCdlGenerateRom}); this.codeDataLoggerToolStripMenuItem.Image = global::Mesen.GUI.Properties.Resources.VerifiedData; this.codeDataLoggerToolStripMenuItem.Name = "codeDataLoggerToolStripMenuItem"; this.codeDataLoggerToolStripMenuItem.Size = new System.Drawing.Size(201, 22); @@ -300,8 +297,8 @@ // mnuCdlGenerateRom // this.mnuCdlGenerateRom.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuCdlStripUnusedData, - this.mnuCdlStripUsedData}); + this.mnuCdlStripUnusedData, + this.mnuCdlStripUsedData}); this.mnuCdlGenerateRom.Image = global::Mesen.GUI.Properties.Resources.Copy; this.mnuCdlGenerateRom.Name = "mnuCdlGenerateRom"; this.mnuCdlGenerateRom.Size = new System.Drawing.Size(197, 22); @@ -335,26 +332,26 @@ // debugToolStripMenuItem // this.debugToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuContinue, - this.mnuBreak, - this.toolStripMenuItem3, - this.mnuStepInto, - this.mnuStepOver, - this.mnuStepOut, - this.mnuStepBack, - this.toolStripMenuItem1, - this.mnuReset, - this.mnuPowerCycle, - this.toolStripMenuItem24, - this.mnuToggleBreakpoint, - this.mnuEnableDisableBreakpoint, - this.toolStripMenuItem2, - this.mnuRunPpuCycle, - this.mnuRunScanline, - this.mnuRunOneFrame, - this.toolStripMenuItem8, - this.mnuBreakIn, - this.mnuBreakOn}); + this.mnuContinue, + this.mnuBreak, + this.toolStripMenuItem3, + this.mnuStepInto, + this.mnuStepOver, + this.mnuStepOut, + this.mnuStepBack, + this.toolStripMenuItem1, + this.mnuReset, + this.mnuPowerCycle, + this.toolStripMenuItem24, + this.mnuToggleBreakpoint, + this.mnuEnableDisableBreakpoint, + this.toolStripMenuItem2, + this.mnuRunPpuCycle, + this.mnuRunScanline, + this.mnuRunOneFrame, + this.toolStripMenuItem8, + this.mnuBreakIn, + this.mnuBreakOn}); this.debugToolStripMenuItem.Name = "debugToolStripMenuItem"; this.debugToolStripMenuItem.Size = new System.Drawing.Size(54, 20); this.debugToolStripMenuItem.Text = "Debug"; @@ -493,14 +490,14 @@ // searchToolStripMenuItem // this.searchToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuGoToAll, - this.toolStripMenuItem11, - this.mnuFind, - this.mnuFindNext, - this.mnuFindPrev, - this.toolStripMenuItem9, - this.mnuFindAllOccurrences, - this.mnuGoTo}); + this.mnuGoToAll, + this.toolStripMenuItem11, + this.mnuFind, + this.mnuFindNext, + this.mnuFindPrev, + this.toolStripMenuItem9, + this.mnuFindAllOccurrences, + this.mnuGoTo}); this.searchToolStripMenuItem.Name = "searchToolStripMenuItem"; this.searchToolStripMenuItem.Size = new System.Drawing.Size(54, 20); this.searchToolStripMenuItem.Text = "Search"; @@ -554,15 +551,15 @@ // mnuGoTo // this.mnuGoTo.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuGoToAddress, - this.toolStripMenuItem23, - this.mnuGoToProgramCounter, - this.toolStripMenuItem22, - this.mnuGoToResetHandler, - this.mnuGoToIrqHandler, - this.mnuGoToNmiHandler, - this.mnuGoToBrkHandler, - this.mnuGoToCopHandler}); + this.mnuGoToAddress, + this.toolStripMenuItem23, + this.mnuGoToProgramCounter, + this.toolStripMenuItem22, + this.mnuGoToResetHandler, + this.mnuGoToIrqHandler, + this.mnuGoToNmiHandler, + this.mnuGoToBrkHandler, + this.mnuGoToCopHandler}); this.mnuGoTo.Name = "mnuGoTo"; this.mnuGoTo.Size = new System.Drawing.Size(183, 22); this.mnuGoTo.Text = "Go To..."; @@ -624,13 +621,13 @@ // optionsToolStripMenuItem // this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuDisassemblyOptions, - this.mnuBreakOptions, - this.toolStripMenuItem5, - this.mnuFontOptions, - this.toolStripMenuItem4, - this.mnuConfigureColors, - this.mnuPreferences}); + this.mnuDisassemblyOptions, + this.mnuBreakOptions, + this.toolStripMenuItem5, + this.mnuFontOptions, + this.toolStripMenuItem4, + this.mnuConfigureColors, + this.mnuPreferences}); this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20); this.optionsToolStripMenuItem.Text = "Options"; @@ -638,12 +635,12 @@ // mnuDisassemblyOptions // this.mnuDisassemblyOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuUnidentifiedData, - this.mnuVerifiedData, - this.toolStripMenuItem6, - this.mnuShowByteCode, - this.mnuUseLowerCaseDisassembly, - this.mnuUseAltSpcOpNames}); + this.mnuUnidentifiedData, + this.mnuVerifiedData, + this.toolStripMenuItem6, + this.mnuShowByteCode, + this.mnuUseLowerCaseDisassembly, + this.mnuUseAltSpcOpNames}); this.mnuDisassemblyOptions.Name = "mnuDisassemblyOptions"; this.mnuDisassemblyOptions.Size = new System.Drawing.Size(209, 22); this.mnuDisassemblyOptions.Text = "Disassembly Options"; @@ -651,9 +648,9 @@ // mnuUnidentifiedData // this.mnuUnidentifiedData.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuHideUnident, - this.mnuDisassembleUnident, - this.mnuShowUnident}); + this.mnuHideUnident, + this.mnuDisassembleUnident, + this.mnuShowUnident}); this.mnuUnidentifiedData.Image = global::Mesen.GUI.Properties.Resources.UnidentifiedData; this.mnuUnidentifiedData.Name = "mnuUnidentifiedData"; this.mnuUnidentifiedData.Size = new System.Drawing.Size(217, 22); @@ -681,9 +678,9 @@ // mnuVerifiedData // this.mnuVerifiedData.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuHideData, - this.mnuDisassembleData, - this.mnuShowData}); + this.mnuHideData, + this.mnuDisassembleData, + this.mnuShowData}); this.mnuVerifiedData.Image = global::Mesen.GUI.Properties.Resources.VerifiedData; this.mnuVerifiedData.Name = "mnuVerifiedData"; this.mnuVerifiedData.Size = new System.Drawing.Size(217, 22); @@ -737,18 +734,18 @@ // mnuBreakOptions // this.mnuBreakOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuBreakOnPowerCycleReset, - this.mnuBreakOnOpen, - this.toolStripMenuItem12, - this.mnuBreakOnBrk, - this.mnuBreakOnCop, - this.mnuBreakOnStp, - this.mnuBreakOnWdm, - this.sepBreakOnUnitRead, - this.mnuBreakOnUnitRead, - this.toolStripMenuItem10, - this.mnuBringToFrontOnBreak, - this.mnuBringToFrontOnPause}); + this.mnuBreakOnPowerCycleReset, + this.mnuBreakOnOpen, + this.sepBrkCopStpWdm, + this.mnuBreakOnBrk, + this.mnuBreakOnCop, + this.mnuBreakOnStp, + this.mnuBreakOnWdm, + this.sepBreakOnUnitRead, + this.mnuBreakOnUnitRead, + this.toolStripMenuItem10, + this.mnuBringToFrontOnBreak, + this.mnuBringToFrontOnPause}); this.mnuBreakOptions.Name = "mnuBreakOptions"; this.mnuBreakOptions.Size = new System.Drawing.Size(209, 22); this.mnuBreakOptions.Text = "Break Options"; @@ -766,10 +763,10 @@ this.mnuBreakOnOpen.Size = new System.Drawing.Size(261, 22); this.mnuBreakOnOpen.Text = "Break when debugger is opened"; // - // toolStripMenuItem12 + // sepBrkCopStpWdm // - this.toolStripMenuItem12.Name = "toolStripMenuItem12"; - this.toolStripMenuItem12.Size = new System.Drawing.Size(258, 6); + this.sepBrkCopStpWdm.Name = "sepBrkCopStpWdm"; + this.sepBrkCopStpWdm.Size = new System.Drawing.Size(258, 6); // // mnuBreakOnBrk // @@ -832,11 +829,11 @@ // mnuFontOptions // this.mnuFontOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuIncreaseFontSize, - this.mnuDecreaseFontSize, - this.mnuResetFontSize, - this.toolStripMenuItem21, - this.mnuSelectFont}); + this.mnuIncreaseFontSize, + this.mnuDecreaseFontSize, + this.mnuResetFontSize, + this.toolStripMenuItem21, + this.mnuSelectFont}); this.mnuFontOptions.Image = global::Mesen.GUI.Properties.Resources.Font; this.mnuFontOptions.Name = "mnuFontOptions"; this.mnuFontOptions.Size = new System.Drawing.Size(209, 22); @@ -908,7 +905,7 @@ // ctrlSplitContainer.Panel1 // this.ctrlSplitContainer.Panel1.Controls.Add(this.ctrlDisassemblyView); - this.ctrlSplitContainer.Panel1.Controls.Add(this.panel1); + this.ctrlSplitContainer.Panel1.Controls.Add(this.pnlStatus); this.ctrlSplitContainer.Panel1MinSize = 275; // // ctrlSplitContainer.Panel2 @@ -921,16 +918,13 @@ // // panel1 // - this.panel1.Controls.Add(this.ctrlLabelList); - this.panel1.Controls.Add(this.ctrlPpuStatus); - this.panel1.Controls.Add(this.ctrlGsuStatus); - this.panel1.Controls.Add(this.ctrlSpcStatus); - this.panel1.Controls.Add(this.ctrlCpuStatus); - this.panel1.Dock = System.Windows.Forms.DockStyle.Right; - this.panel1.Location = new System.Drawing.Point(484, 0); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(348, 433); - this.panel1.TabIndex = 2; + this.pnlStatus.Controls.Add(this.ctrlLabelList); + this.pnlStatus.Controls.Add(this.ctrlPpuStatus); + this.pnlStatus.Dock = System.Windows.Forms.DockStyle.Right; + this.pnlStatus.Location = new System.Drawing.Point(484, 0); + this.pnlStatus.Name = "pnlStatus"; + this.pnlStatus.Size = new System.Drawing.Size(348, 433); + this.pnlStatus.TabIndex = 2; // // ctrlLabelList // @@ -951,33 +945,6 @@ this.ctrlPpuStatus.Size = new System.Drawing.Size(348, 47); this.ctrlPpuStatus.TabIndex = 3; // - // ctrlGsuStatus - // - this.ctrlGsuStatus.Dock = System.Windows.Forms.DockStyle.Top; - this.ctrlGsuStatus.Location = new System.Drawing.Point(0, 268); - this.ctrlGsuStatus.Name = "ctrlGsuStatus"; - this.ctrlGsuStatus.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); - this.ctrlGsuStatus.Size = new System.Drawing.Size(348, 236); - this.ctrlGsuStatus.TabIndex = 5; - // - // ctrlSpcStatus - // - this.ctrlSpcStatus.Dock = System.Windows.Forms.DockStyle.Top; - this.ctrlSpcStatus.Location = new System.Drawing.Point(0, 148); - this.ctrlSpcStatus.Name = "ctrlSpcStatus"; - this.ctrlSpcStatus.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); - this.ctrlSpcStatus.Size = new System.Drawing.Size(348, 120); - this.ctrlSpcStatus.TabIndex = 2; - // - // ctrlCpuStatus - // - this.ctrlCpuStatus.Dock = System.Windows.Forms.DockStyle.Top; - this.ctrlCpuStatus.Location = new System.Drawing.Point(0, 0); - this.ctrlCpuStatus.Name = "ctrlCpuStatus"; - this.ctrlCpuStatus.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0); - this.ctrlCpuStatus.Size = new System.Drawing.Size(348, 148); - this.ctrlCpuStatus.TabIndex = 1; - // // tlpBottomPanel // this.tlpBottomPanel.ColumnCount = 3; @@ -1095,7 +1062,7 @@ this.ctrlSplitContainer.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.ctrlSplitContainer)).EndInit(); this.ctrlSplitContainer.ResumeLayout(false); - this.panel1.ResumeLayout(false); + this.pnlStatus.ResumeLayout(false); this.tlpBottomPanel.ResumeLayout(false); this.grpWatch.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.picWatchHelp)).EndInit(); @@ -1137,7 +1104,6 @@ private System.Windows.Forms.GroupBox grpWatch; private System.Windows.Forms.GroupBox grpBreakpoints; private Controls.ctrlBreakpoints ctrlBreakpoints; - private Controls.ctrlCpuStatus ctrlCpuStatus; private GUI.Controls.ctrlMesenToolStrip tsToolbar; private System.Windows.Forms.GroupBox grpCallstack; private Controls.ctrlCallstack ctrlCallstack; @@ -1168,9 +1134,8 @@ private System.Windows.Forms.ToolStripMenuItem mnuSelectFont; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem4; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem5; - private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Panel pnlStatus; private Controls.ctrlPpuStatus ctrlPpuStatus; - private Controls.ctrlSpcStatus ctrlSpcStatus; private Controls.ctrlLabelList ctrlLabelList; private System.Windows.Forms.ToolStripMenuItem mnuDisassemblyOptions; private System.Windows.Forms.ToolStripMenuItem mnuUnidentifiedData; @@ -1194,7 +1159,7 @@ private System.Windows.Forms.ToolStripMenuItem mnuBringToFrontOnBreak; private System.Windows.Forms.ToolStripMenuItem mnuBringToFrontOnPause; private System.Windows.Forms.ToolStripMenuItem mnuBreakOnPowerCycleReset; - private System.Windows.Forms.ToolStripSeparator toolStripMenuItem12; + private System.Windows.Forms.ToolStripSeparator sepBrkCopStpWdm; private System.Windows.Forms.ToolStripMenuItem mnuBreakOnStp; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem importExportToolStripMenuItem; @@ -1204,23 +1169,22 @@ private System.Windows.Forms.ToolStripMenuItem mnuResetCdlLog; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem13; private System.Windows.Forms.ToolStripMenuItem mnuExit; - private Controls.ctrlGsuStatus ctrlGsuStatus; - private System.Windows.Forms.ToolStripMenuItem mnuUseAltSpcOpNames; - private System.Windows.Forms.ToolStripMenuItem mnuUseLowerCaseDisassembly; - private System.Windows.Forms.ToolStripMenuItem mnuGoToAll; - private System.Windows.Forms.ToolStripSeparator toolStripMenuItem11; - private System.Windows.Forms.ToolStripMenuItem mnuConfigureColors; - private System.Windows.Forms.ToolStripMenuItem mnuSaveRomAs; - private System.Windows.Forms.ToolStripMenuItem mnuSaveAsIps; - private System.Windows.Forms.ToolStripSeparator toolStripMenuItem14; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private System.Windows.Forms.ToolStripMenuItem mnuCdlGenerateRom; - private System.Windows.Forms.ToolStripMenuItem mnuCdlStripUnusedData; - private System.Windows.Forms.ToolStripMenuItem mnuCdlStripUsedData; - private System.Windows.Forms.ToolStripSeparator toolStripMenuItem15; - private System.Windows.Forms.ToolStripMenuItem mnuImportLabels; - private System.Windows.Forms.ToolStripMenuItem mnuExportLabels; - private System.Windows.Forms.ToolStripMenuItem mnuReloadRom; - private System.Windows.Forms.ToolStripSeparator toolStripMenuItem16; - } + private System.Windows.Forms.ToolStripMenuItem mnuUseAltSpcOpNames; + private System.Windows.Forms.ToolStripMenuItem mnuUseLowerCaseDisassembly; + private System.Windows.Forms.ToolStripMenuItem mnuGoToAll; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem11; + private System.Windows.Forms.ToolStripMenuItem mnuConfigureColors; + private System.Windows.Forms.ToolStripMenuItem mnuSaveRomAs; + private System.Windows.Forms.ToolStripMenuItem mnuSaveAsIps; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem14; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem mnuCdlGenerateRom; + private System.Windows.Forms.ToolStripMenuItem mnuCdlStripUnusedData; + private System.Windows.Forms.ToolStripMenuItem mnuCdlStripUsedData; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem15; + private System.Windows.Forms.ToolStripMenuItem mnuImportLabels; + private System.Windows.Forms.ToolStripMenuItem mnuExportLabels; + private System.Windows.Forms.ToolStripMenuItem mnuReloadRom; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem16; + } } \ No newline at end of file diff --git a/UI/Debugger/frmDebugger.cs b/UI/Debugger/frmDebugger.cs index bc7a554..3f4b6a4 100644 --- a/UI/Debugger/frmDebugger.cs +++ b/UI/Debugger/frmDebugger.cs @@ -22,6 +22,11 @@ namespace Mesen.GUI.Debugger private bool _firstBreak = true; private int _destAddress = -1; + private ctrlCpuStatus ctrlCpuStatus; + private ctrlSpcStatus ctrlSpcStatus; + private ctrlGsuStatus ctrlGsuStatus; + private ctrlNecDspStatus ctrlNecDspStatus; + public CpuType CpuType { get { return _cpuType; } } public frmDebugger(CpuType cpuType) @@ -49,6 +54,11 @@ namespace Mesen.GUI.Debugger ctrlDisassemblyView.Initialize(new CpuDisassemblyManager(), new CpuLineStyleProvider()); ConfigApi.SetDebuggerFlag(DebuggerFlags.CpuDebuggerEnabled, true); this.Text = "CPU Debugger"; + + this.ctrlCpuStatus = new ctrlCpuStatus(); + this.ctrlCpuStatus.Padding = new Padding(3, 0, 3, 0); + this.ctrlCpuStatus.Dock = DockStyle.Top; + pnlStatus.Controls.Add(this.ctrlCpuStatus); break; case CpuType.Spc: @@ -60,12 +70,22 @@ namespace Mesen.GUI.Debugger sepBreakOnUnitRead.Visible = false; mnuUseAltSpcOpNames.Visible = true; this.Text = "SPC Debugger"; + + this.ctrlSpcStatus = new ctrlSpcStatus(); + this.ctrlSpcStatus.Padding = new Padding(3, 0, 3, 0); + this.ctrlSpcStatus.Dock = DockStyle.Top; + pnlStatus.Controls.Add(this.ctrlSpcStatus); break; case CpuType.Sa1: ctrlDisassemblyView.Initialize(new Sa1DisassemblyManager(), new Sa1LineStyleProvider()); ConfigApi.SetDebuggerFlag(DebuggerFlags.Sa1DebuggerEnabled, true); this.Text = "SA-1 Debugger"; + + this.ctrlCpuStatus = new ctrlCpuStatus(); + this.ctrlCpuStatus.Padding = new Padding(3, 0, 3, 0); + this.ctrlCpuStatus.Dock = DockStyle.Top; + pnlStatus.Controls.Add(this.ctrlCpuStatus); break; case CpuType.Gsu: @@ -77,13 +97,43 @@ namespace Mesen.GUI.Debugger mnuStepOut.Visible = false; mnuStepInto.Text = "Step"; tlpBottomPanel.ColumnCount = 2; - + + sepBrkCopStpWdm.Visible = false; mnuBreakOnWdm.Visible = false; mnuBreakOnCop.Visible = false; mnuBreakOnStp.Visible = false; mnuBreakOnBrk.Visible = false; sepBreakOnUnitRead.Visible = false; mnuBreakOnUnitRead.Visible = false; + + this.ctrlGsuStatus = new ctrlGsuStatus(); + this.ctrlGsuStatus.Padding = new Padding(3, 0, 3, 0); + this.ctrlGsuStatus.Dock = DockStyle.Top; + pnlStatus.Controls.Add(this.ctrlGsuStatus); + break; + + case CpuType.NecDsp: + ctrlDisassemblyView.Initialize(new NecDspDisassemblyManager(), new NecDspLineStyleProvider()); + ConfigApi.SetDebuggerFlag(DebuggerFlags.NecDspDebuggerEnabled, true); + this.Text = "DSP Debugger"; + ctrlCallstack.Visible = false; + mnuStepOver.Visible = false; + mnuStepOut.Visible = false; + mnuStepInto.Text = "Step"; + tlpBottomPanel.ColumnCount = 2; + + sepBrkCopStpWdm.Visible = false; + mnuBreakOnWdm.Visible = false; + mnuBreakOnCop.Visible = false; + mnuBreakOnStp.Visible = false; + mnuBreakOnBrk.Visible = false; + sepBreakOnUnitRead.Visible = false; + mnuBreakOnUnitRead.Visible = false; + + this.ctrlNecDspStatus = new ctrlNecDspStatus(); + this.ctrlNecDspStatus.Padding = new Padding(3, 0, 3, 0); + this.ctrlNecDspStatus.Dock = DockStyle.Top; + pnlStatus.Controls.Add(this.ctrlNecDspStatus); break; } @@ -119,6 +169,7 @@ namespace Mesen.GUI.Debugger case CpuType.Spc: ConfigApi.SetDebuggerFlag(DebuggerFlags.SpcDebuggerEnabled, false); break; case CpuType.Sa1: ConfigApi.SetDebuggerFlag(DebuggerFlags.Sa1DebuggerEnabled, false); break; case CpuType.Gsu: ConfigApi.SetDebuggerFlag(DebuggerFlags.GsuDebuggerEnabled, false); break; + case CpuType.NecDsp: ConfigApi.SetDebuggerFlag(DebuggerFlags.NecDspDebuggerEnabled, false); break; } BreakpointManager.RemoveCpuType(_cpuType); @@ -280,7 +331,7 @@ namespace Mesen.GUI.Debugger { tsToolbar.AddItemsToToolbar(mnuContinue, mnuBreak, null); - if(_cpuType != CpuType.Gsu) { + if(_cpuType != CpuType.Gsu && _cpuType != CpuType.NecDsp) { tsToolbar.AddItemsToToolbar(mnuStepInto, mnuStepOver, mnuStepOut, null); } else { tsToolbar.AddItemsToToolbar(mnuStepInto, null); @@ -371,24 +422,13 @@ namespace Mesen.GUI.Debugger private void UpdateDebugger(DebugState state, int? activeAddress) { - if(_cpuType == CpuType.Cpu) { - ctrlCpuStatus.UpdateStatus(state.Cpu); - } else if(_cpuType == CpuType.Sa1) { - ctrlCpuStatus.UpdateStatus(state.Sa1); - } else { - ctrlCpuStatus.Visible = false; - } - - if(_cpuType == CpuType.Spc) { - ctrlSpcStatus.UpdateStatus(state); - } else { - ctrlSpcStatus.Visible = false; - } - - if(_cpuType == CpuType.Gsu) { - ctrlGsuStatus.UpdateStatus(state.Gsu); - } else { - ctrlGsuStatus.Visible = false; + switch(_cpuType) { + case CpuType.Cpu: ctrlCpuStatus.UpdateStatus(state.Cpu); break; + case CpuType.Spc: ctrlSpcStatus.UpdateStatus(state.Spc); break; + case CpuType.NecDsp: ctrlNecDspStatus.UpdateStatus(state.NecDsp); break; + case CpuType.Sa1: ctrlCpuStatus.UpdateStatus(state.Sa1); break; + case CpuType.Gsu: ctrlGsuStatus.UpdateStatus(state.Gsu); break; + default: throw new Exception("Unsupported CPU type"); } ctrlPpuStatus.UpdateStatus(state); @@ -396,7 +436,7 @@ namespace Mesen.GUI.Debugger ctrlDisassemblyView.SetActiveAddress(activeAddress); ctrlWatch.UpdateWatch(true); - if(_cpuType != CpuType.Gsu) { + if(_cpuType != CpuType.Gsu && _cpuType != CpuType.NecDsp) { ctrlCallstack.UpdateCallstack(_cpuType); } } @@ -444,6 +484,10 @@ namespace Mesen.GUI.Debugger DebugState state = DebugApi.GetState(); this.BeginInvoke((MethodInvoker)(() => { + //Refresh workspace here as well as frmMain to ensure workspace + //is up-to-date no matter which form is notified first. + DebugWorkspaceManager.GetWorkspace(); + bool isPowerCycle = e.Parameter.ToInt32() != 0; if(!isPowerCycle) { DebugWorkspaceManager.ImportDbgFile(); @@ -474,6 +518,7 @@ namespace Mesen.GUI.Debugger switch(_cpuType) { case CpuType.Cpu: activeAddress = (int)((state.Cpu.K << 16) | state.Cpu.PC); break; case CpuType.Spc: activeAddress = (int)state.Spc.PC; break; + case CpuType.NecDsp: activeAddress = (int)(state.NecDsp.PC * 3); break; case CpuType.Sa1: activeAddress = (int)((state.Sa1.K << 16) | state.Sa1.PC); break; case CpuType.Gsu: activeAddress = (int)((state.Gsu.ProgramBank << 16) | state.Gsu.R[15]); break; default: throw new Exception("Unsupported cpu type"); diff --git a/UI/Forms/frmMain.Designer.cs b/UI/Forms/frmMain.Designer.cs index 079f1c3..e892f84 100644 --- a/UI/Forms/frmMain.Designer.cs +++ b/UI/Forms/frmMain.Designer.cs @@ -31,6 +31,7 @@ this.mnuMain = new Mesen.GUI.Controls.ctrlMesenMenuStrip(); this.mnuFile = new System.Windows.Forms.ToolStripMenuItem(); this.mnuOpen = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuReloadRom = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); this.mnuSaveState = new System.Windows.Forms.ToolStripMenuItem(); this.mnuLoadState = new System.Windows.Forms.ToolStripMenuItem(); @@ -166,6 +167,7 @@ this.mnuSpcDebugger = new System.Windows.Forms.ToolStripMenuItem(); this.mnuSa1Debugger = new System.Windows.Forms.ToolStripMenuItem(); this.mnuGsuDebugger = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuNecDspDebugger = new System.Windows.Forms.ToolStripMenuItem(); this.mnuHelp = new System.Windows.Forms.ToolStripMenuItem(); this.mnuCheckForUpdates = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem20 = new System.Windows.Forms.ToolStripSeparator(); @@ -174,7 +176,6 @@ this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem(); this.pnlRenderer = new System.Windows.Forms.Panel(); this.ctrlRecentGames = new Mesen.GUI.Controls.ctrlRecentGames(); - this.mnuReloadRom = new System.Windows.Forms.ToolStripMenuItem(); this.mnuMain.SuspendLayout(); this.pnlRenderer.SuspendLayout(); this.SuspendLayout(); @@ -224,49 +225,56 @@ // this.mnuOpen.Image = global::Mesen.GUI.Properties.Resources.Folder; this.mnuOpen.Name = "mnuOpen"; - this.mnuOpen.Size = new System.Drawing.Size(180, 22); + this.mnuOpen.Size = new System.Drawing.Size(140, 22); this.mnuOpen.Text = "Open"; // + // mnuReloadRom + // + this.mnuReloadRom.Image = global::Mesen.GUI.Properties.Resources.Refresh; + this.mnuReloadRom.Name = "mnuReloadRom"; + this.mnuReloadRom.Size = new System.Drawing.Size(140, 22); + this.mnuReloadRom.Text = "Reload ROM"; + // // toolStripMenuItem2 // this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(177, 6); + this.toolStripMenuItem2.Size = new System.Drawing.Size(137, 6); // // mnuSaveState // this.mnuSaveState.Name = "mnuSaveState"; - this.mnuSaveState.Size = new System.Drawing.Size(180, 22); + this.mnuSaveState.Size = new System.Drawing.Size(140, 22); this.mnuSaveState.Text = "Save State"; this.mnuSaveState.DropDownOpening += new System.EventHandler(this.mnuSaveState_DropDownOpening); // // mnuLoadState // this.mnuLoadState.Name = "mnuLoadState"; - this.mnuLoadState.Size = new System.Drawing.Size(180, 22); + this.mnuLoadState.Size = new System.Drawing.Size(140, 22); this.mnuLoadState.Text = "Load State"; this.mnuLoadState.DropDownOpening += new System.EventHandler(this.mnuLoadState_DropDownOpening); // // toolStripMenuItem10 // this.toolStripMenuItem10.Name = "toolStripMenuItem10"; - this.toolStripMenuItem10.Size = new System.Drawing.Size(177, 6); + this.toolStripMenuItem10.Size = new System.Drawing.Size(137, 6); // // mnuRecentFiles // this.mnuRecentFiles.Name = "mnuRecentFiles"; - this.mnuRecentFiles.Size = new System.Drawing.Size(180, 22); + this.mnuRecentFiles.Size = new System.Drawing.Size(140, 22); this.mnuRecentFiles.Text = "Recent Files"; // // toolStripMenuItem6 // this.toolStripMenuItem6.Name = "toolStripMenuItem6"; - this.toolStripMenuItem6.Size = new System.Drawing.Size(177, 6); + this.toolStripMenuItem6.Size = new System.Drawing.Size(137, 6); // // mnuExit // this.mnuExit.Image = global::Mesen.GUI.Properties.Resources.Exit; this.mnuExit.Name = "mnuExit"; - this.mnuExit.Size = new System.Drawing.Size(180, 22); + this.mnuExit.Size = new System.Drawing.Size(140, 22); this.mnuExit.Text = "Exit"; // // mnuGame @@ -288,7 +296,7 @@ this.mnuPause.Enabled = false; this.mnuPause.Image = global::Mesen.GUI.Properties.Resources.MediaPause; this.mnuPause.Name = "mnuPause"; - this.mnuPause.Size = new System.Drawing.Size(180, 22); + this.mnuPause.Size = new System.Drawing.Size(139, 22); this.mnuPause.Text = "Pause"; // // mnuReset @@ -296,7 +304,7 @@ this.mnuReset.Enabled = false; this.mnuReset.Image = global::Mesen.GUI.Properties.Resources.Refresh; this.mnuReset.Name = "mnuReset"; - this.mnuReset.Size = new System.Drawing.Size(180, 22); + this.mnuReset.Size = new System.Drawing.Size(139, 22); this.mnuReset.Text = "Reset"; // // mnuPowerCycle @@ -304,19 +312,19 @@ this.mnuPowerCycle.Enabled = false; this.mnuPowerCycle.Image = global::Mesen.GUI.Properties.Resources.PowerCycle; this.mnuPowerCycle.Name = "mnuPowerCycle"; - this.mnuPowerCycle.Size = new System.Drawing.Size(180, 22); + this.mnuPowerCycle.Size = new System.Drawing.Size(139, 22); this.mnuPowerCycle.Text = "Power Cycle"; // // toolStripMenuItem24 // this.toolStripMenuItem24.Name = "toolStripMenuItem24"; - this.toolStripMenuItem24.Size = new System.Drawing.Size(177, 6); + this.toolStripMenuItem24.Size = new System.Drawing.Size(136, 6); // // mnuPowerOff // this.mnuPowerOff.Image = global::Mesen.GUI.Properties.Resources.MediaStop; this.mnuPowerOff.Name = "mnuPowerOff"; - this.mnuPowerOff.Size = new System.Drawing.Size(180, 22); + this.mnuPowerOff.Size = new System.Drawing.Size(139, 22); this.mnuPowerOff.Text = "Power Off"; // // mnuOptions @@ -1100,7 +1108,8 @@ this.toolStripMenuItem22, this.mnuSpcDebugger, this.mnuSa1Debugger, - this.mnuGsuDebugger}); + this.mnuGsuDebugger, + this.mnuNecDspDebugger}); this.mnuDebug.Name = "mnuDebug"; this.mnuDebug.Size = new System.Drawing.Size(54, 20); this.mnuDebug.Text = "Debug"; @@ -1227,6 +1236,13 @@ this.mnuGsuDebugger.Size = new System.Drawing.Size(183, 22); this.mnuGsuDebugger.Text = "GSU Debugger"; // + // mnuNecDspDebugger + // + this.mnuNecDspDebugger.Image = global::Mesen.GUI.Properties.Resources.NecDspDebugger; + this.mnuNecDspDebugger.Name = "mnuNecDspDebugger"; + this.mnuNecDspDebugger.Size = new System.Drawing.Size(183, 22); + this.mnuNecDspDebugger.Text = "DSP Debugger"; + // // mnuHelp // this.mnuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -1295,13 +1311,6 @@ this.ctrlRecentGames.TabIndex = 1; this.ctrlRecentGames.Visible = false; // - // mnuReloadRom - // - this.mnuReloadRom.Image = global::Mesen.GUI.Properties.Resources.Refresh; - this.mnuReloadRom.Name = "mnuReloadRom"; - this.mnuReloadRom.Size = new System.Drawing.Size(180, 22); - this.mnuReloadRom.Text = "Reload ROM"; - // // frmMain // this.AllowDrop = true; @@ -1475,5 +1484,6 @@ private System.Windows.Forms.ToolStripSeparator toolStripMenuItem26; private System.Windows.Forms.ToolStripMenuItem mnuAssembler; private System.Windows.Forms.ToolStripMenuItem mnuReloadRom; + private System.Windows.Forms.ToolStripMenuItem mnuNecDspDebugger; } } \ No newline at end of file diff --git a/UI/Forms/frmMain.cs b/UI/Forms/frmMain.cs index 1f18bce..4ebbac8 100644 --- a/UI/Forms/frmMain.cs +++ b/UI/Forms/frmMain.cs @@ -280,6 +280,7 @@ namespace Mesen.GUI.Forms mnuSpcDebugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenSpcDebugger)); mnuSa1Debugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenSa1Debugger)); mnuGsuDebugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenGsuDebugger)); + mnuNecDspDebugger.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenNecDspDebugger)); mnuMemoryTools.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenMemoryTools)); mnuEventViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenEventViewer)); mnuTilemapViewer.InitShortcut(this, nameof(DebuggerShortcutsConfig.OpenTilemapViewer)); @@ -342,6 +343,7 @@ namespace Mesen.GUI.Forms mnuSpcDebugger.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.SpcDebugger); }; mnuSa1Debugger.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.Sa1Debugger); }; mnuGsuDebugger.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.GsuDebugger); }; + mnuNecDspDebugger.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.NecDspDebugger); }; mnuTraceLogger.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.TraceLogger); }; mnuMemoryTools.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.MemoryTools); }; mnuTilemapViewer.Click += (s, e) => { DebugWindowManager.OpenDebugWindow(DebugWindow.TilemapViewer); }; @@ -435,6 +437,19 @@ namespace Mesen.GUI.Forms mnuGsuDebugger.Enabled = coprocessor == CoprocessorType.GSU; mnuGsuDebugger.Visible = coprocessor == CoprocessorType.GSU; + bool isNecDsp = ( + coprocessor == CoprocessorType.DSP1 || + coprocessor == CoprocessorType.DSP1B || + coprocessor == CoprocessorType.DSP2 || + coprocessor == CoprocessorType.DSP3 || + coprocessor == CoprocessorType.DSP4 || + coprocessor == CoprocessorType.ST010 || + coprocessor == CoprocessorType.ST011 + ); + + mnuNecDspDebugger.Enabled = isNecDsp; + mnuNecDspDebugger.Visible = isNecDsp; + mnuTraceLogger.Enabled = running; mnuScriptWindow.Enabled = running; mnuMemoryTools.Enabled = running; diff --git a/UI/Interop/ConfigApi.cs b/UI/Interop/ConfigApi.cs index 99730e5..2a25454 100644 --- a/UI/Interop/ConfigApi.cs +++ b/UI/Interop/ConfigApi.cs @@ -62,6 +62,7 @@ namespace Mesen.GUI UseAltSpcOpNames = 0x1000, UseLowerCaseDisassembly = 0x2000, + NecDspDebuggerEnabled = 0x08000000, GsuDebuggerEnabled = 0x10000000, Sa1DebuggerEnabled = 0x20000000, SpcDebuggerEnabled = 0x40000000, diff --git a/UI/Interop/DebugApi.cs b/UI/Interop/DebugApi.cs index ece968e..45fe38f 100644 --- a/UI/Interop/DebugApi.cs +++ b/UI/Interop/DebugApi.cs @@ -188,6 +188,7 @@ namespace Mesen.GUI CpuMemory, SpcMemory, Sa1Memory, + NecDspMemory, GsuMemory, PrgRom, WorkRam, @@ -504,7 +505,8 @@ namespace Mesen.GUI Spc, NecDsp, Sa1, - Gsu + Gsu, + Cx4 } public static class CpuTypeExtensions @@ -514,6 +516,7 @@ namespace Mesen.GUI switch(cpuType) { case CpuType.Cpu: return SnesMemoryType.CpuMemory; case CpuType.Spc: return SnesMemoryType.SpcMemory; + case CpuType.NecDsp: return SnesMemoryType.NecDspMemory; case CpuType.Sa1: return SnesMemoryType.Sa1Memory; case CpuType.Gsu: return SnesMemoryType.GsuMemory; @@ -527,6 +530,7 @@ namespace Mesen.GUI switch(cpuType) { case CpuType.Cpu: return 6; case CpuType.Spc: return 4; + case CpuType.NecDsp: return 4; case CpuType.Sa1: return 6; case CpuType.Gsu: return 6; diff --git a/UI/Properties/Resources.Designer.cs b/UI/Properties/Resources.Designer.cs index 7adfd67..5dd6e72 100644 --- a/UI/Properties/Resources.Designer.cs +++ b/UI/Properties/Resources.Designer.cs @@ -690,6 +690,16 @@ namespace Mesen.GUI.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap NecDspDebugger { + get { + object obj = ResourceManager.GetObject("NecDspDebugger", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/UI/Properties/Resources.resx b/UI/Properties/Resources.resx index f367cdd..884c5b8 100644 --- a/UI/Properties/Resources.resx +++ b/UI/Properties/Resources.resx @@ -463,4 +463,7 @@ ..\Resources\CloseWhite.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\NecDspDebugger.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/UI/Resources/NecDspDebugger.png b/UI/Resources/NecDspDebugger.png new file mode 100644 index 0000000000000000000000000000000000000000..328dd95f4a5bdb04ab86c90b704355a49d44573f GIT binary patch literal 691 zcmV;k0!;mhP)<{98FWQhbW?9;ba!ELWdLwtX>N2bZe?^J zG%heMF*(%MvSa`N0x(HLK~y+Tm6BgbQ*ji>F9^bVGEvu`O;{6jAoZ}-vbjYBMlU5{ zXi*RSdzj%%U@!TQG$O0zd}$9+kQfUif*QWaU|R(xH*+;KnhRr7M)RUsjupnYbAIu= zEVBm>eE9v&x##=+o%_32Nxt3t7p6L6fH0KgWkfGgPH?URK+%PqFk7uPcQ=|hoT)Gw zDyd%I+GaaS%^=G8`9B7Uv1S1$BnoV{RKe0(KbXM#w$kxxHvsW%BR)6?xhGQJx{ zZ4}GdJ6KBh;cKcNxpWZ24{Vbx)(u96>)2pZYnu`NtBrU(xE&v32at<(p`do+d&-B! zscvZRJE48Jgg3EcAWb_N)XG<=?(&)*s*w(4QumS1KE=2B=UB)*K{mb<*~mf6zdMaN zm7c3dkRHE?>%C_FDg{MR#I1g@?=mijLk-A(@?&w@hhp*^3dvK*^NC?A5+ioZyl%nt zt9|%9aRNiZnibNCucF-RuaFEzqfx9ECFnCqnnZ!eB6!asb7ple`fv4=31}p*G?0y@ ztBlgR=)ZPBTqOTl>i-NRt8>wR<-DS^mVu15>Z1R$SJ9CM4DUH)E`@UC5dF03aAAE! Z@f(YsGGK7r_uT*h002ovPDHLkV1k~+Gt&S7 literal 0 HcmV?d00001 diff --git a/UI/UI.csproj b/UI/UI.csproj index 63179ca..1869e08 100644 --- a/UI/UI.csproj +++ b/UI/UI.csproj @@ -259,6 +259,8 @@ + + @@ -279,6 +281,12 @@ + + UserControl + + + ctrlNecDspStatus.cs + Component @@ -971,6 +979,7 @@ + Always @@ -1040,6 +1049,9 @@ ctrlCallstack.cs + + ctrlNecDspStatus.cs + ctrlMemoryAccessCounters.cs