From 13a901146f3939d53ecc18791bd2174d60d8384f Mon Sep 17 00:00:00 2001 From: nakeee Date: Mon, 10 Aug 2009 09:20:12 +0000 Subject: [PATCH] DSPLLE: - Extension fixes (Joined work with LM) - Shuffle fix for my off by one error git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3958 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DSPCore/Src/DSPIntExtOps.cpp | 42 +++++++++++++++----- Source/Core/DSPCore/Src/DSPIntExtOps.h | 3 ++ Source/Core/DSPCore/Src/DSPTables.h | 4 +- Source/Core/DSPCore/Src/DspIntArithmetic.cpp | 8 ++-- 4 files changed, 41 insertions(+), 16 deletions(-) diff --git a/Source/Core/DSPCore/Src/DSPIntExtOps.cpp b/Source/Core/DSPCore/Src/DSPIntExtOps.cpp index 12432dc1ce..fcc50a6a61 100644 --- a/Source/Core/DSPCore/Src/DSPIntExtOps.cpp +++ b/Source/Core/DSPCore/Src/DSPIntExtOps.cpp @@ -49,6 +49,8 @@ namespace DSPInterpreter namespace Ext { +u16 cache1; + // DR $arR // xxxx xxxx 0000 01rr // Decrement addressing register $arR. @@ -77,12 +79,20 @@ void nr(const UDSPInstruction& opc) { // Move value of $acS.l to the $axD.l. void mv(const UDSPInstruction& opc) { - u8 sreg = opc.hex & 0x3; - u8 dreg = ((opc.hex >> 2) & 0x3); - - g_dsp.r[dreg + DSP_REG_AXL0] = g_dsp.r[sreg + DSP_REG_ACC0]; + u8 sreg = opc.hex & 0x3; + + cache1 = g_dsp.r[sreg + DSP_REG_ACC0]; + + currentEpilogeFunc = mv_epi; } +void mv_epi(const UDSPInstruction& opc) +{ + u8 dreg = ((opc.hex >> 2) & 0x3); + + g_dsp.r[dreg + DSP_REG_AXL0] = cache1; +} + // S @$D, $acD.l // xxxx xxxx 001s s0dd // Store value of $(acS.l) in the memory pointed by register $D. @@ -122,7 +132,6 @@ void sn_epi(const UDSPInstruction& opc) { u8 dreg = opc.hex & 0x3; - dsp_increase_addr_reg(dreg, (s16)g_dsp.r[DSP_REG_IX0 + dreg]); } @@ -133,11 +142,17 @@ void sn_epi(const UDSPInstruction& opc) void l(const UDSPInstruction& opc) { u8 sreg = opc.hex & 0x3; + + cache1 = dsp_dmem_read(g_dsp.r[sreg]); + + currentEpilogeFunc = l_epi; +} + +void l_epi(const UDSPInstruction& opc) { + u8 sreg = opc.hex & 0x3; u8 dreg = ((opc.hex >> 3) & 0x7) + DSP_REG_AXL0; - u16 val = dsp_dmem_read(g_dsp.r[sreg]); - g_dsp.r[dreg] = val; - + g_dsp.r[dreg] = cache1; dsp_increment_addr_reg(sreg); } @@ -150,9 +165,16 @@ void ln(const UDSPInstruction& opc) u8 sreg = opc.hex & 0x3; u8 dreg = ((opc.hex >> 3) & 0x7) + DSP_REG_AXL0; - u16 val = dsp_dmem_read(g_dsp.r[sreg]); - g_dsp.r[dreg] = val; + cache1 = dsp_dmem_read(g_dsp.r[sreg]); + currentEpilogeFunc = ln_epi; +} +void ln_epi(const UDSPInstruction& opc) +{ + u8 sreg = opc.hex & 0x3; + u8 dreg = ((opc.hex >> 3) & 0x7) + DSP_REG_AXL0; + + g_dsp.r[dreg] = cache1; dsp_increase_addr_reg(sreg, (s16)g_dsp.r[DSP_REG_IX0 + sreg]); } diff --git a/Source/Core/DSPCore/Src/DSPIntExtOps.h b/Source/Core/DSPCore/Src/DSPIntExtOps.h index 848b6fa176..7ee6590f6d 100644 --- a/Source/Core/DSPCore/Src/DSPIntExtOps.h +++ b/Source/Core/DSPCore/Src/DSPIntExtOps.h @@ -39,7 +39,9 @@ namespace DSPInterpreter namespace Ext { void l(const UDSPInstruction& opc); +void l_epi(const UDSPInstruction& opc); void ln(const UDSPInstruction& opc); +void ln_epi(const UDSPInstruction& opc); void ls(const UDSPInstruction& opc); void lsn(const UDSPInstruction& opc); void lsm(const UDSPInstruction& opc); @@ -65,6 +67,7 @@ void ldn(const UDSPInstruction& opc); void ldm(const UDSPInstruction& opc); void ldnm(const UDSPInstruction& opc); void mv(const UDSPInstruction& opc); +void mv_epi(const UDSPInstruction& opc); void dr(const UDSPInstruction& opc); void ir(const UDSPInstruction& opc); void nr(const UDSPInstruction& opc); diff --git a/Source/Core/DSPCore/Src/DSPTables.h b/Source/Core/DSPCore/Src/DSPTables.h index bcc37626c4..7484a34360 100644 --- a/Source/Core/DSPCore/Src/DSPTables.h +++ b/Source/Core/DSPCore/Src/DSPTables.h @@ -66,8 +66,8 @@ enum partype_t #define P_EXT 0x80 -#define OPTABLE_SIZE 65536 -#define EXT_OPTABLE_SIZE 0xff +#define OPTABLE_SIZE 0xffff + 1 +#define EXT_OPTABLE_SIZE 0xff + 1 union UDSPInstruction { diff --git a/Source/Core/DSPCore/Src/DspIntArithmetic.cpp b/Source/Core/DSPCore/Src/DspIntArithmetic.cpp index fe6570986d..00c89bee35 100644 --- a/Source/Core/DSPCore/Src/DspIntArithmetic.cpp +++ b/Source/Core/DSPCore/Src/DspIntArithmetic.cpp @@ -459,9 +459,9 @@ void addax(const UDSPInstruction& opc) Update_SR_Register64(acc); } -// ADDR $acD, $(DSP_REG_AXL0+S) +// ADDR $acD.M, $axS.L // 0100 0ssd xxxx xxxx -// Adds register $(DSP_REG_AXL0+S) to accumulator $acD register. +// Adds register $axS.L to accumulator $acD register. void addr(const UDSPInstruction& opc) { u8 areg = (opc.hex >> 8) & 0x1; @@ -477,9 +477,9 @@ void addr(const UDSPInstruction& opc) Update_SR_Register64(acc); } -// SUBR $acD, $(DSP_REG_AXL0+S) +// SUBR $acD.M, $axS.L // 0101 0ssd xxxx xxxx -// Subtracts register $(DSP_REG_AXL0+S) from accumulator $acD register. +// Subtracts register $axS.L from accumulator $acD.M register. void subr(const UDSPInstruction& opc) { u8 areg = (opc.hex >> 8) & 0x1;