make tsta into helper function

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2889 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-04-05 21:11:47 +00:00
parent e3b1356f3d
commit 360c7e69e6
5 changed files with 21 additions and 14 deletions

View File

@ -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)

View File

@ -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

View File

@ -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},

View File

@ -156,4 +156,4 @@ bool CheckCondition(u8 _Condition)
return taken;
}
} // namespace
} // namespace

View File

@ -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);