From 573a7f4d6e07b981ad39e996254ea9541098cd3b Mon Sep 17 00:00:00 2001 From: hrydgard Date: Tue, 12 Jan 2010 00:38:54 +0000 Subject: [PATCH] DSPLLE: Add a comment describing my latest unverified theory: that 'l and the other opcode extensions might be meant to sign extend the loaded value in some cases. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4811 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DSPCore/Src/DSPIntUtil.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Source/Core/DSPCore/Src/DSPIntUtil.h b/Source/Core/DSPCore/Src/DSPIntUtil.h index aabf286eda..f9f369e3e7 100644 --- a/Source/Core/DSPCore/Src/DSPIntUtil.h +++ b/Source/Core/DSPCore/Src/DSPIntUtil.h @@ -140,6 +140,21 @@ 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; + // Enabling the below sign extension code breaks things. + // There's probably some condition that enable it, maybe one of + // the status flags like M2. + // Or maybe it only happens when this call is a result of 'l and similar extended opcodes. + + // Sign extend the loaded register. ACM0 + // g_dsp.r[reg - DSP_REG_ACM0 + DSP_REG_ACH0] = ((s16)val < 0 ? 0xFFFF : 0); + // g_dsp.r[reg - DSP_REG_ACM0 + DSP_REG_ACL0] = 0; // ? + break; + + // There might also be something similar for AX.L but I'm not at all sure about that. + // Stack registers. case DSP_REG_ST0: case DSP_REG_ST1: