From f7bf29a5289f17fd26a865af7e49c90333016db5 Mon Sep 17 00:00:00 2001 From: Marko Pusljar Date: Sun, 21 Feb 2010 13:23:29 +0000 Subject: [PATCH] DSPLLE - 'L ext opcode fix git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5095 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DSPCore/Src/DSPIntExtOps.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Source/Core/DSPCore/Src/DSPIntExtOps.cpp b/Source/Core/DSPCore/Src/DSPIntExtOps.cpp index 4bc722263d..c55dd464be 100644 --- a/Source/Core/DSPCore/Src/DSPIntExtOps.cpp +++ b/Source/Core/DSPCore/Src/DSPIntExtOps.cpp @@ -121,8 +121,20 @@ void l(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_increment_addr_reg(sreg)); + // 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]); + 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_increment_addr_reg(sreg)); + } + else + { + writeToBackLog(0, dreg, dsp_dmem_read(g_dsp.r[sreg])); + writeToBackLog(1, sreg, dsp_increment_addr_reg(sreg)); + } } // LN axD.l, @$S