DSPLLE - addaxl,mulc,'ln fix

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5138 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Marko Pusljar 2010-02-27 21:24:25 +00:00
parent 0425ff2f06
commit ff8ce634e3
3 changed files with 19 additions and 9 deletions

View File

@ -121,7 +121,6 @@ void l(const UDSPInstruction& opc)
u8 sreg = opc.hex & 0x3;
u8 dreg = ((opc.hex >> 3) & 0x7) + DSP_REG_AXL0;
// 40bit sign extension if target is acm.D (important for zelda type ucodes)
if ((dreg >= DSP_REG_ACM0) && (g_dsp.r[DSP_REG_SR] & SR_40_MODE_BIT))
{
u16 val = dsp_dmem_read(g_dsp.r[sreg]);
@ -146,8 +145,19 @@ void ln(const UDSPInstruction& opc)
u8 sreg = opc.hex & 0x3;
u8 dreg = ((opc.hex >> 3) & 0x7) + DSP_REG_AXL0;
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[sreg]));
writeToBackLog(1, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg]));
if ((dreg >= DSP_REG_ACM0) && (g_dsp.r[DSP_REG_SR] & SR_40_MODE_BIT))
{
u16 val = dsp_dmem_read(g_dsp.r[sreg]);
writeToBackLog(0, dreg - DSP_REG_ACM0 + DSP_REG_ACH0, (val & 0x8000) ? 0xFFFF : 0x0000);
writeToBackLog(1, dreg, val);
writeToBackLog(2, dreg - DSP_REG_ACM0 + DSP_REG_ACL0, 0);
writeToBackLog(3, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg]));
}
else
{
writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[sreg]));
writeToBackLog(1, sreg, dsp_increase_addr_reg(sreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg]));
}
}
// LS $axD.l, $acS.m

View File

@ -58,15 +58,15 @@ void addaxl(const UDSPInstruction& opc)
u8 sreg = (opc.hex >> 9) & 0x1;
u8 dreg = (opc.hex >> 8) & 0x1;
s64 acc = dsp_get_long_acc(dreg);
s64 acx = dsp_get_ax_l(sreg);
u64 acc = (u64)dsp_get_long_acc(dreg);
u16 acx = (u16)dsp_get_ax_l(sreg);
acc += acx;
zeroWriteBackLog();
dsp_set_long_acc(dreg, acc);
Update_SR_Register64(acc);
dsp_set_long_acc(dreg, (s64)acc);
Update_SR_Register64((s64)acc);
}
// TSTAXH $axR.h

View File

@ -184,8 +184,8 @@ void tstprod(const UDSPInstruction& opc)
// secondary accumulator $axS (treat them both as signed).
void mulc(const UDSPInstruction& opc)
{
u8 sreg = (opc.hex >> 11) & 0x1;
u8 treg = (opc.hex >> 12) & 0x1;
u8 sreg = (opc.hex >> 12) & 0x1;
u8 treg = (opc.hex >> 11) & 0x1;
u16 accm = dsp_get_acc_m(sreg);
u16 axh = dsp_get_ax_h(treg);
s64 prod = dsp_multiply(accm, axh);