DSPDisassembler: remove unused base_addr parameter

This commit is contained in:
Michael Maltese 2017-05-24 15:20:31 -07:00
parent 2564823522
commit 1d0185d7d5
5 changed files with 11 additions and 12 deletions

View File

@ -56,7 +56,7 @@ bool Disassemble(const std::vector<u16>& code, bool line_numbers, std::string& t
settings.decode_registers = true; settings.decode_registers = true;
DSPDisassembler disasm(settings); DSPDisassembler disasm(settings);
bool success = disasm.Disassemble(code, 0x0000, text); bool success = disasm.Disassemble(code, text);
return success; return success;
} }
@ -79,9 +79,9 @@ bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2)
{ {
std::string line1, line2; std::string line1, line2;
u16 pc = i; u16 pc = i;
disassembler.DisassembleOpcode(&code1[0], 0x0000, &pc, line1); disassembler.DisassembleOpcode(&code1[0], &pc, line1);
pc = i; pc = i;
disassembler.DisassembleOpcode(&code2[0], 0x0000, &pc, line2); disassembler.DisassembleOpcode(&code2[0], &pc, line2);
printf("!! %04x : %04x vs %04x - %s vs %s\n", i, code1[i], code2[i], line1.c_str(), printf("!! %04x : %04x vs %04x - %s vs %s\n", i, code1[i], code2[i], line1.c_str(),
line2.c_str()); line2.c_str());
} }
@ -94,7 +94,7 @@ bool Compare(const std::vector<u16>& code1, const std::vector<u16>& code2)
{ {
u16 pc = i; u16 pc = i;
std::string line; std::string line;
disassembler.DisassembleOpcode(&longest[0], 0x0000, &pc, line); disassembler.DisassembleOpcode(&longest[0], &pc, line);
printf("!! %s\n", line.c_str()); printf("!! %s\n", line.c_str());
} }
} }

View File

@ -25,11 +25,11 @@ DSPDisassembler::DSPDisassembler(const AssemblerSettings& settings) : settings_(
{ {
} }
bool DSPDisassembler::Disassemble(const std::vector<u16>& code, int base_addr, std::string& text) bool DSPDisassembler::Disassemble(const std::vector<u16>& code, std::string& text)
{ {
for (u16 pc = 0; pc < code.size();) for (u16 pc = 0; pc < code.size();)
{ {
if (!DisassembleOpcode(code.data(), base_addr, &pc, text)) if (!DisassembleOpcode(code.data(), &pc, text))
return false; return false;
text.append("\n"); text.append("\n");
} }
@ -129,8 +129,7 @@ std::string DSPDisassembler::DisassembleParameters(const DSPOPCTemplate& opc, u1
return buf; return buf;
} }
bool DSPDisassembler::DisassembleOpcode(const u16* binbuf, int base_addr, u16* pc, bool DSPDisassembler::DisassembleOpcode(const u16* binbuf, u16* pc, std::string& dest)
std::string& dest)
{ {
if ((*pc & 0x7fff) >= 0x1000) if ((*pc & 0x7fff) >= 0x1000)
{ {

View File

@ -34,10 +34,10 @@ class DSPDisassembler
public: public:
explicit DSPDisassembler(const AssemblerSettings& settings); explicit DSPDisassembler(const AssemblerSettings& settings);
bool Disassemble(const std::vector<u16>& code, int base_addr, std::string& text); bool Disassemble(const std::vector<u16>& code, std::string& text);
// Warning - this one is trickier to use right. // Warning - this one is trickier to use right.
bool DisassembleOpcode(const u16* binbuf, int base_addr, u16* pc, std::string& dest); bool DisassembleOpcode(const u16* binbuf, u16* pc, std::string& dest);
private: private:
std::string DisassembleParameters(const DSPOPCTemplate& opc, u16 op1, u16 op2); std::string DisassembleParameters(const DSPOPCTemplate& opc, u16 op1, u16 op2);

View File

@ -230,7 +230,7 @@ void AutoDisassembly(u16 start_addr, u16 end_addr)
addr_to_line[addr] = line_counter; addr_to_line[addr] = line_counter;
std::string buf; std::string buf;
if (!disasm.DisassembleOpcode(ptr, 0, &addr, buf)) if (!disasm.DisassembleOpcode(ptr, &addr, buf))
{ {
ERROR_LOG(DSPLLE, "disasm failed at %04x", addr); ERROR_LOG(DSPLLE, "disasm failed at %04x", addr);
break; break;

View File

@ -23,7 +23,7 @@ static bool RoundTrippableDissassemble(const std::vector<u16>& code, std::string
settings.show_pc = false; settings.show_pc = false;
DSP::DSPDisassembler disasm(settings); DSP::DSPDisassembler disasm(settings);
return disasm.Disassemble(code, 0x0000, text); return disasm.Disassemble(code, text);
} }
// This test goes from text ASM to binary to text ASM and once again back to binary. // This test goes from text ASM to binary to text ASM and once again back to binary.