diff options
| author | hrydgard <hrydgard@gmail.com> | 2009-06-21 08:39:21 +0000 |
|---|---|---|
| committer | hrydgard <hrydgard@gmail.com> | 2009-06-21 08:39:21 +0000 |
| commit | aecaf271f1fe98cba1ebc8228ff9eff3e39e72c5 (patch) | |
| tree | 4c82001793b35149ae81fcb483f13b22d3b6fa11 /Source/Core/DSPCore/Src/disassemble.cpp | |
| parent | 80217a6ed718d15c75784090340cd3ddd9432f96 (diff) | |
New DSP debugger: step one. (not ready yet, but try loading zelda WW and look at the dsp debugger..).
Had to shuffle around quite a lot of code to be able to extract the CodeView into a library nicely so it can be used from both the main dolphin and the LLE plugin... also extracted the symboldb code.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3517 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DSPCore/Src/disassemble.cpp')
| -rw-r--r-- | Source/Core/DSPCore/Src/disassemble.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/Core/DSPCore/Src/disassemble.cpp b/Source/Core/DSPCore/Src/disassemble.cpp index b3ffd72ede..c58465e9fe 100644 --- a/Source/Core/DSPCore/Src/disassemble.cpp +++ b/Source/Core/DSPCore/Src/disassemble.cpp @@ -82,7 +82,7 @@ bool DSPDisassembler::Disassemble(int start_pc, const std::vector<u16> &code, in fclose(f); // Run the two passes. - return DisFile(tmp1, 1, text) && DisFile(tmp1, 2, text); + return DisFile(tmp1, base_addr, 1, text) && DisFile(tmp1, base_addr, 2, text); } char *DSPDisassembler::DisParams(const DSPOPCTemplate& opc, u16 op1, u16 op2, char *strbuf) @@ -186,7 +186,7 @@ static void MakeLowerCase(char *ptr) } } -void DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 *pc, std::string &dest) +bool DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 *pc, std::string &dest) { char buffer[256]; char *buf = buffer; @@ -200,11 +200,10 @@ void DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 { *pc++; dest.append("; outside memory"); - return; + return false; } - *pc &= 0x0fff; - const u32 op1 = binbuf[*pc]; + const u32 op1 = binbuf[*pc & 0x0fff]; const DSPOPCTemplate *opc = NULL; const DSPOPCTemplate *opc_ext = NULL; @@ -259,7 +258,7 @@ void DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 // Size 2 - the op has a large immediate. if ((opc->size & ~P_EXT) == 2) { - op2 = binbuf[*pc + 1]; + op2 = binbuf[(*pc + 1) & 0x0fff]; if (settings_.show_hex) buf += sprintf(buf, "%04x %04x ", op1, op2); } @@ -318,9 +317,10 @@ void DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 if (pass == 2) dest.append(buffer); + return true; } -bool DSPDisassembler::DisFile(const char* name, int pass, std::string &output) +bool DSPDisassembler::DisFile(const char* name, int base_addr, int pass, std::string &output) { FILE* in = fopen(name, "rb"); if (in == NULL) @@ -339,7 +339,7 @@ bool DSPDisassembler::DisFile(const char* name, int pass, std::string &output) // Actually do the disassembly. for (u16 pc = 0; pc < (size / 2);) { - DisOpcode(binbuf, 0x0000, pass, &pc, output); + DisOpcode(binbuf, base_addr, pass, &pc, output); if (pass == 2) output.append("\n"); } |
