From 4832ffa3777aab9fe4f51d174ef521e91d6579df Mon Sep 17 00:00:00 2001 From: nakeee Date: Sun, 5 Apr 2009 16:50:15 +0000 Subject: [PATCH] implemented mulcmv mulcmvz and fixed mulcac to actually add to the acc git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2880 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Src/DSPInterpreter.cpp | 27 +++++++++++++++---- .../Src/DSPInterpreter.h | 9 ++++--- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp index 4784d2deb3..503c6fa6e0 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp @@ -360,16 +360,33 @@ void mulc(const UDSPInstruction& opc) Update_SR_Register64(prod); } -// TODO: Implement void mulcmvz(const UDSPInstruction& opc) { - ERROR_LOG(DSPHLE, "dsp_opc.hex_mulcmvz ni"); + s64 TempProd = dsp_get_long_prod(); + + // update prod + u8 sreg = (opc.hex >> 12) & 0x1; + s64 Prod = (s64)dsp_get_acc_m(sreg) * (s64)dsp_get_acc_h(sreg) * GetMultiplyModifier(); + dsp_set_long_prod(Prod); + + // update acc + u8 rreg = (opc.hex >> 8) & 0x1; + s64 acc = TempProd & ~0xffff; // clear lower 4 bytes + dsp_set_long_acc(rreg, acc); } -// TODO: Implement void mulcmv(const UDSPInstruction& opc) { - ERROR_LOG(DSPHLE, "dsp_opc.hex_mulcmv ni"); + s64 TempProd = dsp_get_long_prod(); + + // update prod + u8 sreg = (opc.hex >> 12) & 0x1; + s64 Prod = (s64)dsp_get_acc_m(sreg) * (s64)dsp_get_acc_h(sreg) * GetMultiplyModifier(); + dsp_set_long_prod(Prod); + + // update acc + u8 rreg = (opc.hex >> 8) & 0x1; + dsp_set_long_acc(rreg, TempProd); } void cmpar(const UDSPInstruction& opc) @@ -436,7 +453,7 @@ void mulcac(const UDSPInstruction& opc) // update acc u8 rreg = (opc.hex >> 8) & 0x1; - dsp_set_long_acc(rreg, TempProd); + dsp_set_long_acc(rreg, TempProd + g_dsp.r[rreg]); } void movr(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 66e132222e..d9ec31f1da 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.h @@ -89,7 +89,6 @@ void dar(const UDSPInstruction& opc); void iar(const UDSPInstruction& opc); void sbclr(const UDSPInstruction& opc); void sbset(const UDSPInstruction& opc); -void mov(const UDSPInstruction& opc); void movp(const UDSPInstruction& opc); void mul(const UDSPInstruction& opc); void mulac(const UDSPInstruction& opc); @@ -99,6 +98,9 @@ void mulx(const UDSPInstruction& opc); void mulxac(const UDSPInstruction& opc); void mulxmv(const UDSPInstruction& opc); void mulxmvz(const UDSPInstruction& opc); +void mulcmvz(const UDSPInstruction& opc); +void mulcmv(const UDSPInstruction& opc); +void movnp(const UDSPInstruction& opc); void sub(const UDSPInstruction& opc); void maddx(const UDSPInstruction& opc); void msubx(const UDSPInstruction& opc); @@ -122,9 +124,8 @@ void ori(const UDSPInstruction& opc); // END OF FIXMEs // TODO: PENDING IMPLEMENTATION / UNIMPLEMENTED -void mulcmvz(const UDSPInstruction& opc); -void mulcmv(const UDSPInstruction& opc); -void movnp(const UDSPInstruction& opc); +void mov(const UDSPInstruction& opc); + // END OF UNIMPLEMENTED };