diff --git a/Source/Core/DSPCore/Src/DSPTables.cpp b/Source/Core/DSPCore/Src/DSPTables.cpp index 6368813f08..6740446c6c 100644 --- a/Source/Core/DSPCore/Src/DSPTables.cpp +++ b/Source/Core/DSPCore/Src/DSPTables.cpp @@ -191,8 +191,8 @@ const DSPOPCTemplate opcodes[] = {"ORC", 0x3e00, 0xfe80, DSPInterpreter::orc, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, true}, {"XORC", 0x3080, 0xfe80, DSPInterpreter::xorc, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, true}, //new {"NOT", 0x3280, 0xfe80, DSPInterpreter::notc, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, true}, //new - {"LSRNRX1", 0x3480, 0xfc80, DSPInterpreter::lsrnrx, nop, 1 | P_EXT, 1, {{P_ACC, 1, 0, 8, 0x0100}}, true}, //new - {"LSRNRX2", 0x3880, 0xfc80, DSPInterpreter::lsrnrx, nop, 1 | P_EXT, 1, {{P_ACC, 1, 0, 8, 0x0100}}, true}, //new + {"LSRNRX", 0x3480, 0xfc80, DSPInterpreter::lsrnrx, nop, 1 | P_EXT, 1, {{P_ACC, 1, 0, 8, 0x0100}}, true}, //new + {"LSRNRX", 0x3880, 0xfc80, DSPInterpreter::lsrnrx, nop, 1 | P_EXT, 1, {{P_ACC, 1, 0, 8, 0x0100}}, true}, //new {"LSRNR", 0x3c80, 0xfc80, DSPInterpreter::lsrnr, nop, 1 | P_EXT, 1, {{P_ACC, 1, 0, 8, 0x0100}}, true}, // discovered by luigi! //4 @@ -227,7 +227,7 @@ const DSPOPCTemplate opcodes[] = {"CLR", 0x8100, 0xf700, DSPInterpreter::clr, nop, 1 | P_EXT, 1, {{P_ACC, 1, 0, 11, 0x0800}}, true}, // clear acc0 {"CMP", 0x8200, 0xff00, DSPInterpreter::cmp, nop, 1 | P_EXT, 0, {}, true}, //0x8300 - unknown - not used atm - could be cmp(acc1-acc0) - {"CLRP", 0x8400, 0xff00, DSPInterpreter::clrp, nop, 1 | P_EXT, 0, {}, }, + {"CLRP", 0x8400, 0xff00, DSPInterpreter::clrp, nop, 1 | P_EXT, 0, {}, true}, //0x8500 - unknown mul opcode (modifies prod regs) - not used atm {"TSTAXH", 0x8600, 0xfe00, DSPInterpreter::tstaxh, nop, 1 | P_EXT, 1, {{P_REG1A, 1, 0, 8, 0x0100}}, true}, {"M2", 0x8a00, 0xff00, DSPInterpreter::srbith, nop, 1 | P_EXT, 0, {}, true}, diff --git a/Source/Core/DSPCore/Src/disassemble.cpp b/Source/Core/DSPCore/Src/disassemble.cpp index bcc2b5b1d8..7019131a69 100644 --- a/Source/Core/DSPCore/Src/disassemble.cpp +++ b/Source/Core/DSPCore/Src/disassemble.cpp @@ -215,12 +215,7 @@ bool DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 // find opcode for (int j = 0; j < opcodes_size; j++) { - u16 mask; - - if (opcodes[j].size & P_EXT) - mask = opcodes[j].opcode_mask & 0xff00; - else - mask = opcodes[j].opcode_mask; + u16 mask = opcodes[j].opcode_mask; if ((op1 & mask) == opcodes[j].opcode) { @@ -232,8 +227,14 @@ bool DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 if (!opc) opc = &fake_op; - bool extended; - if ((opc->size & P_EXT) && (op1 & 0x00ff)) + bool extended = false; + bool only7bitext = false; + + if (((opc->opcode >> 12) == 0x3) && (op1 & 0x007f)) { + extended = true; + only7bitext = true; + } + else if (((opc->opcode >> 12) > 0x3) && (op1 & 0x00ff)) extended = true; else extended = false; @@ -244,10 +245,19 @@ bool DSPDisassembler::DisOpcode(const u16 *binbuf, int base_addr, int pass, u16 // find opcode for (int j = 0; j < opcodes_ext_size; j++) { - if ((op1 & opcodes_ext[j].opcode_mask) == opcodes_ext[j].opcode) - { - opc_ext = &opcodes_ext[j]; - break; + if (only7bitext) { + if (((op1 & 0x7f) & opcodes_ext[j].opcode_mask) == opcodes_ext[j].opcode) + { + opc_ext = &opcodes_ext[j]; + break; + } + } + else { + if ((op1 & opcodes_ext[j].opcode_mask) == opcodes_ext[j].opcode) + { + opc_ext = &opcodes_ext[j]; + break; + } } } } diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp index 803b6c9bfd..98bf9cc151 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp @@ -78,8 +78,8 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler) // WII CRCs case 0xb7eb9a9c: // Wii Pikmin - PAL case 0xeaeb38cc: // Wii Pikmin 2 - PAL - case 0x6c3f6f94: // zelda - PAL - case 0xd643001f: // mario galaxy - PAL + case 0x6c3f6f94: // Zelda TP - PAL + case 0xd643001f: // Mario Galaxy - PAL / WII DK Jungle Beat - PAL INFO_LOG(DSPHLE, "CRC %08x: Zelda Wii ucode chosen\n", _CRC); return new CUCode_Zelda(_rMailHandler, _CRC);