summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2009-04-12 13:43:12 +0000
committerhrydgard <hrydgard@gmail.com>2009-04-12 13:43:12 +0000
commitd4055b971b9a6a04c8a07fa8cbbdb49c1e2a6c6f (patch)
treea62c879bfaa7af88a236bfd72d9a96f542327249 /Source/Core
parentf6474b98a85877aae2b7c0c8485e280bbf68053a (diff)
DSP asm/disasm: improve the shift instructions so they at least round-trip. not 100% sure it's correct though.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2957 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DSPCore/Src/DSPTables.cpp4
-rw-r--r--Source/Core/DSPCore/Src/assemble.cpp4
-rw-r--r--Source/Core/DSPCore/Src/disassemble.cpp10
3 files changed, 7 insertions, 11 deletions
diff --git a/Source/Core/DSPCore/Src/DSPTables.cpp b/Source/Core/DSPCore/Src/DSPTables.cpp
index d05e10a06f..eaf79b562d 100644
--- a/Source/Core/DSPCore/Src/DSPTables.cpp
+++ b/Source/Core/DSPCore/Src/DSPTables.cpp
@@ -154,8 +154,8 @@ const DSPOPCTemplate opcodes[] =
{"SBCLR", 0x1200, 0xfff8, DSPInterpreter::sbclr, nop, 1, 1, {{P_IMM, 1, 0, 0, 0x0007}}, NULL, NULL},
{"SBSET", 0x1300, 0xfff8, DSPInterpreter::sbset, nop, 1, 1, {{P_IMM, 1, 0, 0, 0x0007}}, NULL, NULL},
- {"LSL", 0x1400, 0xfec0, DSPInterpreter::lsl, nop, 1, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x003f}}, NULL, NULL}, // 0x007f?
- {"LSR", 0x1440, 0xfec0, DSPInterpreter::lsr, nop, 1, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x003f}}, NULL, NULL}, // 0x007f?
+ {"LSL", 0x1400, 0xfec0, DSPInterpreter::lsl, nop, 1, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x007f}}, NULL, NULL}, // 0x007f?
+ {"LSR", 0x1440, 0xfec0, DSPInterpreter::lsr, nop, 1, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x007f}}, NULL, NULL}, // 0x007f?
{"ASL", 0x1480, 0xfec0, DSPInterpreter::asl, nop, 1, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x007f}}, NULL, NULL},
{"ASR", 0x14c0, 0xfec0, DSPInterpreter::asr, nop, 1, 2, {{P_ACCM, 1, 0, 8, 0x0100}, {P_IMM, 1, 0, 0, 0x007f}}, NULL, NULL},
diff --git a/Source/Core/DSPCore/Src/assemble.cpp b/Source/Core/DSPCore/Src/assemble.cpp
index 4c35b43b6b..cac1638b41 100644
--- a/Source/Core/DSPCore/Src/assemble.cpp
+++ b/Source/Core/DSPCore/Src/assemble.cpp
@@ -213,12 +213,12 @@ s32 strtoval(const char *str)
if (ptr[0] == '#')
{
ptr++;
- negative = true; // Wow! Double # (needed one to get in here) ]negates???
+ negative = true; // Wow! Double # (needed one to get in here) negates???
}
if (ptr[0] == '-')
{
ptr++;
- negative = true; // Wow! # negates???
+ negative = true;
}
if (ptr[0] == '0')
{
diff --git a/Source/Core/DSPCore/Src/disassemble.cpp b/Source/Core/DSPCore/Src/disassemble.cpp
index 3c5e14ffb8..3a3cb298cb 100644
--- a/Source/Core/DSPCore/Src/disassemble.cpp
+++ b/Source/Core/DSPCore/Src/disassemble.cpp
@@ -46,10 +46,7 @@ char* gd_dis_params(gd_globals_t* gdg, const DSPOPCTemplate* opc, u16 op1, u16 o
for (int j = 0; j < opc->param_count; j++)
{
if (j > 0)
- {
- sprintf(buf, ", ");
- buf += strlen(buf);
- }
+ buf += sprintf(buf, ", ");
if (opc->params[j].loc >= 1)
val = op2;
@@ -63,8 +60,7 @@ char* gd_dis_params(gd_globals_t* gdg, const DSPOPCTemplate* opc, u16 op1, u16 o
else
val = val >> opc->params[j].lshift;
- u32 type;
- type = opc->params[j].type;
+ u32 type = opc->params[j].type;
if ((type & 0xff) == 0x10)
type &= 0xff00;
@@ -106,7 +102,7 @@ char* gd_dis_params(gd_globals_t* gdg, const DSPOPCTemplate* opc, u16 op1, u16 o
if (opc->params[j].size != 2)
{
if (opc->params[j].mask == 0x007f) // LSL, LSR, ASL, ASR
- sprintf(buf, "#%d", val < 64 ? val : -(0x80 - (s32)val));
+ sprintf(buf, "#%d", (val & 0x40) ? (val | 0xFFFFFFC0) : val);
else
sprintf(buf, "#0x%02x", val);
}