DSP: fix IF_CC - could end up in the middle of ops if they were multiword!
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2882 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
4913912dbb
commit
40a7cd15ad
|
@ -32,8 +32,7 @@ namespace DSPInterpreter {
|
||||||
void unknown(const UDSPInstruction& opc)
|
void unknown(const UDSPInstruction& opc)
|
||||||
{
|
{
|
||||||
//_assert_msg_(MASTER_LOG, !g_dsp.exception_in_progress_hack, "assert while exception");
|
//_assert_msg_(MASTER_LOG, !g_dsp.exception_in_progress_hack, "assert while exception");
|
||||||
ERROR_LOG(DSPHLE, "LLE: Unrecognized opcode 0x%04x, pc 0x%04x", opc.hex, g_dsp.pc - 1);
|
ERROR_LOG(DSPHLE, "LLE: Unrecognized opcode 0x%04x, pc 0x%04x", opc.hex, g_dsp.err_pc);
|
||||||
//g_dsp.pc = g_dsp.err_pc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic call implementation
|
// Generic call implementation
|
||||||
|
@ -68,7 +67,8 @@ void ifcc(const UDSPInstruction& opc)
|
||||||
{
|
{
|
||||||
if (!CheckCondition(opc.hex & 0xf))
|
if (!CheckCondition(opc.hex & 0xf))
|
||||||
{
|
{
|
||||||
dsp_fetch_code(); // skip the next opcode
|
// skip the next opcode - we have to lookup its size.
|
||||||
|
g_dsp.pc += opSize[dsp_peek_code()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,16 +91,16 @@ DSPOPCTemplate opcodes[] =
|
||||||
{"CALLLZ", 0x02bd, 0xffff, DSPInterpreter::call, nop, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}}, NULL, NULL},
|
{"CALLLZ", 0x02bd, 0xffff, DSPInterpreter::call, nop, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}}, NULL, NULL},
|
||||||
{"CALL", 0x02bf, 0xffff, DSPInterpreter::call, nop, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}}, NULL, NULL},
|
{"CALL", 0x02bf, 0xffff, DSPInterpreter::call, nop, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}}, NULL, NULL},
|
||||||
|
|
||||||
{"IFNS", 0x0270, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
{"IF NS", 0x0270, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
||||||
{"IFS", 0x0271, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
{"IF S", 0x0271, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
||||||
{"IFG", 0x0272, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
{"IF G", 0x0272, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
||||||
{"IFLE", 0x0273, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
{"IF LE", 0x0273, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
||||||
{"IFNZ", 0x0274, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
{"IF NZ", 0x0274, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
||||||
{"IFZ", 0x0275, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
{"IF Z", 0x0275, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
||||||
{"IFL", 0x0276, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
{"IF L", 0x0276, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
||||||
{"IFGE", 0x0277, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
{"IF GE", 0x0277, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
||||||
{"IFLNZ", 0x027c, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
{"IF LNZ", 0x027c, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
||||||
{"IFLZ", 0x027d, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
{"IF LZ", 0x027d, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL},
|
||||||
{"IF", 0x027f, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, // Hermes doesn't list this
|
{"IF", 0x027f, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, // Hermes doesn't list this
|
||||||
|
|
||||||
{"JNS", 0x0290, 0xffff, DSPInterpreter::jcc, nop, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}}, NULL, NULL},
|
{"JNS", 0x0290, 0xffff, DSPInterpreter::jcc, nop, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}}, NULL, NULL},
|
||||||
|
@ -315,6 +315,7 @@ DSPOPCTemplate opcodes_ext[] =
|
||||||
const u32 opcodes_size = sizeof(opcodes) / sizeof(DSPOPCTemplate);
|
const u32 opcodes_size = sizeof(opcodes) / sizeof(DSPOPCTemplate);
|
||||||
const u32 opcodes_ext_size = sizeof(opcodes_ext) / sizeof(DSPOPCTemplate);
|
const u32 opcodes_ext_size = sizeof(opcodes_ext) / sizeof(DSPOPCTemplate);
|
||||||
|
|
||||||
|
u8 opSize[OPTABLE_SIZE];
|
||||||
dspInstFunc opTable[OPTABLE_SIZE];
|
dspInstFunc opTable[OPTABLE_SIZE];
|
||||||
dspInstFunc prologueTable[OPTABLE_SIZE];
|
dspInstFunc prologueTable[OPTABLE_SIZE];
|
||||||
dspInstFunc epilogueTable[OPTABLE_SIZE];
|
dspInstFunc epilogueTable[OPTABLE_SIZE];
|
||||||
|
@ -332,6 +333,7 @@ void InitInstructionTable()
|
||||||
if ((opcodes[j].opcode_mask & i) == opcodes[j].opcode) {
|
if ((opcodes[j].opcode_mask & i) == opcodes[j].opcode) {
|
||||||
if (opTable[i] == DSPInterpreter::unknown) {
|
if (opTable[i] == DSPInterpreter::unknown) {
|
||||||
opTable[i] = opcodes[j].interpFunc;
|
opTable[i] = opcodes[j].interpFunc;
|
||||||
|
opSize[i] = opcodes[j].size;
|
||||||
prologueTable[i] = opcodes[j].prologue;
|
prologueTable[i] = opcodes[j].prologue;
|
||||||
epilogueTable[i] = opcodes[j].epilogue;
|
epilogueTable[i] = opcodes[j].epilogue;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -110,6 +110,7 @@ extern DSPOPCTemplate opcodes[];
|
||||||
extern const u32 opcodes_size;
|
extern const u32 opcodes_size;
|
||||||
extern DSPOPCTemplate opcodes_ext[];
|
extern DSPOPCTemplate opcodes_ext[];
|
||||||
extern const u32 opcodes_ext_size;
|
extern const u32 opcodes_ext_size;
|
||||||
|
extern u8 opSize[OPTABLE_SIZE];
|
||||||
|
|
||||||
extern dspInstFunc opTable[];
|
extern dspInstFunc opTable[];
|
||||||
|
|
||||||
|
|
|
@ -73,11 +73,6 @@ void UpdateCachedCR()
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
|
|
||||||
void dbg_error(char* err_msg)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gdsp_init()
|
void gdsp_init()
|
||||||
{
|
{
|
||||||
// Why do we have DROM? Does it exist? Has it been dumped?
|
// Why do we have DROM? Does it exist? Has it been dumped?
|
||||||
|
@ -242,6 +237,9 @@ void gdsp_loop_step()
|
||||||
|
|
||||||
u16 HLE_ROM_80E7_81F8();
|
u16 HLE_ROM_80E7_81F8();
|
||||||
void hacks();
|
void hacks();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void gdsp_step()
|
void gdsp_step()
|
||||||
{
|
{
|
||||||
g_dsp.step_counter++;
|
g_dsp.step_counter++;
|
||||||
|
|
|
@ -77,12 +77,6 @@ void (*dsp_op[])(uint16 opc) =
|
||||||
dsp_opcd, dsp_opcd, dsp_ope, dsp_opf,
|
dsp_opcd, dsp_opcd, dsp_ope, dsp_opf,
|
||||||
};
|
};
|
||||||
|
|
||||||
void dbg_error(char* err_msg)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void gdsp_init()
|
void gdsp_init()
|
||||||
{
|
{
|
||||||
g_dsp.irom = (uint16*)malloc(DSP_IROM_SIZE * sizeof(uint16));
|
g_dsp.irom = (uint16*)malloc(DSP_IROM_SIZE * sizeof(uint16));
|
||||||
|
|
Loading…
Reference in New Issue