dsplle - another small fix

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6075 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Marko Pusljar
2010-08-08 16:35:10 +00:00
parent 2ac8691911
commit 95b0abb737
3 changed files with 30 additions and 9 deletions

View File

@ -160,11 +160,6 @@ inline void dsp_op_write_reg(int reg, u16 val)
g_dsp.r[reg] = (u16)(s16)(s8)(u8)val;
break;
case DSP_REG_ACM0:
case DSP_REG_ACM1:
g_dsp.r[reg] = val;
break;
// Stack registers.
case DSP_REG_ST0:
case DSP_REG_ST1:
@ -217,7 +212,19 @@ inline s64 dsp_get_long_prod()
inline s64 dsp_get_long_prod_round_prodl()
{
return (dsp_get_long_prod() + 0x7fff) & ~0xffff;
s64 prod = dsp_get_long_prod();
if (g_dsp.r[DSP_REG_SR] & SR_ROUNDING_MODE)
prod = (prod + 0x8000) & ~0xffff;
else
{
if (prod & 0x10000)
prod = (prod + 0x8000) & ~0xffff;
else
prod = (prod + 0x7fff) & ~0xffff;
}
return prod;
}
// For accurate emulation, this is wrong - but the real prod registers behave
@ -271,6 +278,21 @@ inline s64 dsp_convert_long_acc(s64 val) // s64 -> s40
return ((s64)(s8)(val >> 32))<<32 | (u32)val;
}
inline s64 dsp_round_long_acc(s64 val)
{
if (g_dsp.r[DSP_REG_SR] & SR_ROUNDING_MODE)
val = (val + 0x8000) & ~0xffff;
else
{
if (val & 0x10000)
val = (val + 0x8000) & ~0xffff;
else
val = (val + 0x7fff) & ~0xffff;
}
return val;
}
inline s16 dsp_get_acc_l(int _reg)
{
_assert_(_reg < 2);