dsp llet debugger: disasm the ucode when it's dumped

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2857 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-04-03 19:29:15 +00:00
parent 2a5b8f4366
commit e1c3d1bfd4
7 changed files with 37 additions and 6 deletions

View File

@ -510,7 +510,8 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
wxMenuItem* pJit = pDebugDialogs->Append(IDM_JITWINDOW, _T("&Jit"), wxEmptyString, wxITEM_CHECK); wxMenuItem* pJit = pDebugDialogs->Append(IDM_JITWINDOW, _T("&Jit"), wxEmptyString, wxITEM_CHECK);
pJit->Check(bJitWindow); pJit->Check(bJitWindow);
wxMenuItem* pSound = pDebugDialogs->Append(IDM_SOUNDWINDOW, _T("&Sound"), wxEmptyString); wxMenuItem* pSound = pDebugDialogs->Append(IDM_SOUNDWINDOW, _T("&Sound"), wxEmptyString, wxITEM_CHECK);
pSound->Check(bSoundWindow);
wxMenuItem* pVideo = pDebugDialogs->Append(IDM_VIDEOWINDOW, _T("&Video"), wxEmptyString, wxITEM_CHECK); wxMenuItem* pVideo = pDebugDialogs->Append(IDM_VIDEOWINDOW, _T("&Video"), wxEmptyString, wxITEM_CHECK);
pVideo->Check(bVideoWindow); pVideo->Check(bVideoWindow);

View File

@ -279,6 +279,9 @@ DSPOPCTemplate opcodes[] =
// FIXME: nakee guessing (check masks and params!) // FIXME: nakee guessing (check masks and params!)
{"TSTA?", 0xa100, 0xf7ff, DSPInterpreter::tsta, nop, 1 | P_EXT, 1, {{P_REG18, 1, 0, 11, 0x1000}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, {"TSTA?", 0xa100, 0xf7ff, DSPInterpreter::tsta, nop, 1 | P_EXT, 1, {{P_REG18, 1, 0, 11, 0x1000}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi},
// unknown opcode for disassemble
{"CW", 0x0000, 0x0000, nop, nop, 1, 1, {{P_VAL, 2, 0, 0, 0xffff}}, NULL, NULL,},
}; };
DSPOPCTemplate opcodes_ext[] = DSPOPCTemplate opcodes_ext[] =

View File

@ -62,7 +62,8 @@ void DSPDebuggerLLE::CreateGUIControls()
m_Toolbar->AddTool(ID_STEPTOOL, wxT("Step"), wxNullBitmap, wxT("Step Code "), wxITEM_NORMAL); m_Toolbar->AddTool(ID_STEPTOOL, wxT("Step"), wxNullBitmap, wxT("Step Code "), wxITEM_NORMAL);
m_Toolbar->AddTool(ID_SHOWPCTOOL, wxT("Show Pc"), wxNullBitmap, wxT("Reset To PC counter"), wxITEM_NORMAL); m_Toolbar->AddTool(ID_SHOWPCTOOL, wxT("Show Pc"), wxNullBitmap, wxT("Reset To PC counter"), wxITEM_NORMAL);
m_Toolbar->AddTool(ID_JUMPTOTOOL, wxT("Jump"), wxNullBitmap, wxT("Jump to a specific Address"), wxITEM_NORMAL); m_Toolbar->AddTool(ID_JUMPTOTOOL, wxT("Jump"), wxNullBitmap, wxT("Jump to a specific Address"), wxITEM_NORMAL);
m_Toolbar->AddCheckTool(ID_DUMPCODETOOL, wxT("Dump"), wxNullBitmap, wxNullBitmap, wxT("Dump UCode to File")); m_Toolbar->AddSeparator();
m_Toolbar->AddCheckTool(ID_DUMPCODETOOL, wxT("Dump"), wxNullBitmap, wxNullBitmap, wxT("Dump UCode to file and disasm"));
m_Toolbar->AddSeparator(); m_Toolbar->AddSeparator();
m_Toolbar->AddCheckTool(ID_CHECK_ASSERTINT, wxT("AssertInt"), wxNullBitmap, wxNullBitmap, wxEmptyString); m_Toolbar->AddCheckTool(ID_CHECK_ASSERTINT, wxT("AssertInt"), wxNullBitmap, wxNullBitmap, wxEmptyString);
m_Toolbar->AddCheckTool(ID_CHECK_HALT, wxT("Halt"), wxNullBitmap, wxNullBitmap, wxEmptyString); m_Toolbar->AddCheckTool(ID_CHECK_HALT, wxT("Halt"), wxNullBitmap, wxNullBitmap, wxEmptyString);

View File

@ -67,6 +67,7 @@ private:
ID_SHOWPCTOOL, ID_SHOWPCTOOL,
ID_JUMPTOTOOL, ID_JUMPTOTOOL,
ID_DUMPCODETOOL, ID_DUMPCODETOOL,
ID_DISASMDUMPTOOL,
ID_CHECK_ASSERTINT, ID_CHECK_ASSERTINT,
ID_CHECK_HALT, ID_CHECK_HALT,
ID_CHECK_INIT, ID_CHECK_INIT,

View File

@ -21,6 +21,8 @@
#include "Common.h" #include "Common.h"
#include "Globals.h" #include "Globals.h"
#include "Tools.h"
#include "disassemble.h"
#include "gdsp_interpreter.h" #include "gdsp_interpreter.h"
bool DumpDSPCode(u32 _Address, u32 _Length, u32 crc) bool DumpDSPCode(u32 _Address, u32 _Length, u32 crc)
@ -33,16 +35,39 @@ bool DumpDSPCode(u32 _Address, u32 _Length, u32 crc)
{ {
fwrite(g_dspInitialize.pGetMemoryPointer(_Address), _Length, 1, pFile); fwrite(g_dspInitialize.pGetMemoryPointer(_Address), _Length, 1, pFile);
fclose(pFile); fclose(pFile);
return(true);
} }
else else
{ {
PanicAlert("Cant open file (%s) to dump UCode!!", szFilename); PanicAlert("Cant open file (%s) to dump UCode!!", szFilename);
return false;
} }
return(false); if (!DisasmUCodeDump(crc))
{
PanicAlert("Failed to disasm UCode!!", szFilename);
return false;
}
return true;
} }
bool DisasmUCodeDump(u32 crc)
{
char binFile[MAX_PATH];
char txtFile[MAX_PATH];
sprintf(binFile, "%sDSP_UC_%08X.bin", FULL_DUMP_DIR, crc);
sprintf(txtFile, "%sDSP_UC_%08X.txt", FULL_DUMP_DIR, crc);
FILE* t = fopen(txtFile, "wb");
if (t != NULL)
{
gd_globals_t gdg;
gd_dis_file(&gdg, binFile, t);
fclose(t);
return true;
}
else
return false;
}
u32 GenerateCRC(const unsigned char* _pBuffer, int _pLength) u32 GenerateCRC(const unsigned char* _pBuffer, int _pLength)
{ {

View File

@ -44,7 +44,7 @@ union UDSPControl
: Hex(_Hex) {} : Hex(_Hex) {}
}; };
bool DumpDSPCode(u32 _Address, u32 _Length, u32 crc); bool DumpDSPCode(u32 _Address, u32 _Length, u32 crc);
bool DisasmUCodeDump(u32 crc);
u32 GenerateCRC(const unsigned char* _pBuffer, int _pLength); u32 GenerateCRC(const unsigned char* _pBuffer, int _pLength);
bool DumpCWCode(u32 _Address, u32 _Length); bool DumpCWCode(u32 _Address, u32 _Length);

View File

@ -257,7 +257,7 @@ void gdsp_idma_in(u16 dsp_addr, u32 addr, u32 size)
DEBUG_LOG(DSPHLE, "*** Copy new UCode from 0x%08x to 0x%04x (crc: %8x)\n", addr, dsp_addr, g_dsp.iram_crc); DEBUG_LOG(DSPHLE, "*** Copy new UCode from 0x%08x to 0x%04x (crc: %8x)\n", addr, dsp_addr, g_dsp.iram_crc);
if (g_dsp.dump_imem) if (g_dsp.dump_imem)
DumpDSPCode(addr, size, g_dsp.iram_crc ); DumpDSPCode(addr, size, g_dsp.iram_crc);
} }