From 360c7e69e6d14bbb92508791f509af21e16b9689 Mon Sep 17 00:00:00 2001 From: nakeee Date: Sun, 5 Apr 2009 21:11:47 +0000 Subject: [PATCH] make tsta into helper function git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2889 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Src/DSPInterpreter.cpp | 25 +++++++++++-------- .../Src/DSPInterpreter.h | 5 +++- .../Plugin_DSP_LLE-testing/Src/DSPTables.cpp | 2 +- .../Src/gdsp_condition_codes.cpp | 2 +- .../Src/gdsp_condition_codes.h | 1 + 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp index c14b6eb6db..270e34c74c 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp @@ -35,6 +35,14 @@ void unknown(const UDSPInstruction& opc) ERROR_LOG(DSPHLE, "LLE: Unrecognized opcode 0x%04x, pc 0x%04x", opc.hex, g_dsp.err_pc); } +// test register and updates SR accordingly +void tsta(int reg) +{ + s64 acc = dsp_get_long_acc(reg); + + Update_SR_Register64(acc); +} + // Generic call implementation void call(const UDSPInstruction& opc) { @@ -410,14 +418,9 @@ void cmp(const UDSPInstruction& opc) Update_SR_Register64(acc0 - acc1); } -// WARNING - this instruction is being called by other instructions!!!!! -// Is that sane? -void tsta(const UDSPInstruction& opc) +void tst(const UDSPInstruction& opc) { - u8 reg = (opc.hex >> 11) & 0x1; - s64 acc = dsp_get_long_acc(reg); - - Update_SR_Register64(acc); + tsta((opc.hex >> 11) & 0x1); } void addaxl(const UDSPInstruction& opc) @@ -488,7 +491,7 @@ void movax(const UDSPInstruction& opc) g_dsp.r[0x10 + dreg] = 0; } - tsta(UDSPInstruction(dreg << 11)); + tsta(dreg); } void xorr(const UDSPInstruction& opc) @@ -498,7 +501,7 @@ void xorr(const UDSPInstruction& opc) g_dsp.r[0x1e + dreg] ^= g_dsp.r[0x1a + sreg]; - tsta(UDSPInstruction(dreg << 11)); + tsta(dreg); } void andr(const UDSPInstruction& opc) @@ -508,7 +511,7 @@ void andr(const UDSPInstruction& opc) g_dsp.r[0x1e + dreg] &= g_dsp.r[0x1a + sreg]; - tsta(UDSPInstruction(dreg << 11)); + tsta(dreg); } void orr(const UDSPInstruction& opc) @@ -518,7 +521,7 @@ void orr(const UDSPInstruction& opc) g_dsp.r[0x1e + dreg] |= g_dsp.r[0x1a + sreg]; - tsta(UDSPInstruction(dreg << 11)); + tsta(dreg); } void andc(const UDSPInstruction& opc) diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.h index 722f18f2c3..c8466b0b70 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.h @@ -53,7 +53,7 @@ void clrp(const UDSPInstruction& opc); void mulc(const UDSPInstruction& opc); void cmpar(const UDSPInstruction& opc); void cmp(const UDSPInstruction& opc); -void tsta(const UDSPInstruction& opc); +void tst(const UDSPInstruction& opc); void addaxl(const UDSPInstruction& opc); void addarn(const UDSPInstruction& opc); void mulcac(const UDSPInstruction& opc); @@ -128,6 +128,9 @@ void mov(const UDSPInstruction& opc); // END OF UNIMPLEMENTED + +// Helpers +inline void tsta(int reg); }; #endif // _DSPINTERPRETER_H diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.cpp index 2b7c1c462a..38c9caf8ff 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.cpp @@ -226,10 +226,10 @@ DSPOPCTemplate opcodes[] = {"NEG", 0x7c00, 0xfeff, DSPInterpreter::neg, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, {"MOVNP", 0x7e00, 0xfeff, DSPInterpreter::movnp, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, + {"TST", 0xb100, 0xf7ff, DSPInterpreter::tst, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 11, 0x0800}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, // ??? is seen in burnout2 : opcode 0xa100 // {"???", 0xa100, 0xf7ff, DSPInterpreter::unknown,nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 11, 0x0800}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, - {"TST", 0xb100, 0xf7ff, DSPInterpreter::tsta, nop, 1 | P_EXT, 1, {{P_ACCM, 1, 0, 11, 0x0800}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, {"TSTAXH", 0x8600, 0xfeff, DSPInterpreter::tstaxh, nop, 1 | P_EXT, 1, {{P_REG1A, 1, 0, 8, 0x0100}}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, {"CMP", 0x8200, 0xffff, DSPInterpreter::cmp, nop, 1 | P_EXT, 0, {}, dsp_op_ext_ops_pro, dsp_op_ext_ops_epi}, diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_condition_codes.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_condition_codes.cpp index 3e7c7fbd67..c859d9a8c1 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_condition_codes.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_condition_codes.cpp @@ -156,4 +156,4 @@ bool CheckCondition(u8 _Condition) return taken; } -} // namespace \ No newline at end of file +} // namespace diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_condition_codes.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_condition_codes.h index 5f85494f65..33743a067b 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_condition_codes.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_condition_codes.h @@ -41,6 +41,7 @@ namespace DSPInterpreter { #define SR_MUL_MODIFY 0x2000 // 1 = normal. 0 = x2 bool CheckCondition(u8 _Condition); + int GetMultiplyModifier(); void Update_SR_Register16(s16 _Value);