summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorMarko Pusljar <LM1234@gmail.com>2011-01-14 12:08:45 +0000
committerMarko Pusljar <LM1234@gmail.com>2011-01-14 12:08:45 +0000
commit3cba9afe7944fde767bbfae260ec6168b23e726c (patch)
tree8fc5177e237f753fdbff6e5ba32463b4be44c4d6 /Source/Core
parentb0d2df0bad4d62f7d9977dfb1ac4358986e576df (diff)
dsp cleaning
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6846 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DSPCore/Src/DSPAccelerator.cpp40
-rw-r--r--Source/Core/DSPCore/Src/DSPHWInterface.cpp2
-rw-r--r--Source/Core/DSPCore/Src/DspIntLoadStore.cpp1
-rw-r--r--Source/Core/DSPCore/Src/DspIntMultiplier.cpp3
4 files changed, 20 insertions, 26 deletions
diff --git a/Source/Core/DSPCore/Src/DSPAccelerator.cpp b/Source/Core/DSPCore/Src/DSPAccelerator.cpp
index 29afe98b5f..a45ab15e9d 100644
--- a/Source/Core/DSPCore/Src/DSPAccelerator.cpp
+++ b/Source/Core/DSPCore/Src/DSPAccelerator.cpp
@@ -71,6 +71,7 @@ u16 dsp_read_aram_d3()
const u32 EndAddress = (g_dsp.ifx_regs[DSP_ACEAH] << 16) | g_dsp.ifx_regs[DSP_ACEAL];
u32 Address = (g_dsp.ifx_regs[DSP_ACCAH] << 16) | g_dsp.ifx_regs[DSP_ACCAL];
u16 val = 0;
+
switch (g_dsp.ifx_regs[DSP_FORMAT]) {
case 0x5: // u8 reads
val = DSPHost_ReadHostMemory(Address);
@@ -81,14 +82,16 @@ u16 dsp_read_aram_d3()
Address++;
break;
default:
- ERROR_LOG(DSPLLE, "dsp_read_aram_d3: Unseen Format %i", g_dsp.ifx_regs[DSP_FORMAT]);
+ ERROR_LOG(DSPLLE, "dsp_read_aram_d3() - unknown format 0x%x", g_dsp.ifx_regs[DSP_FORMAT]);
break;
}
+
if (Address >= EndAddress)
{
- // Set address back to start address.
+ // Set address back to start address. (never seen this here!)
Address = (g_dsp.ifx_regs[DSP_ACSAH] << 16) | g_dsp.ifx_regs[DSP_ACSAL];
}
+
g_dsp.ifx_regs[DSP_ACCAH] = Address >> 16;
g_dsp.ifx_regs[DSP_ACCAL] = Address & 0xffff;
return val;
@@ -98,8 +101,8 @@ void dsp_write_aram_d3(u16 value)
{
// Zelda ucode writes a bunch of zeros to ARAM through d3 during
// initialization. Don't know if it ever does it later, too.
- // const u32 EndAddress = (g_dsp.ifx_regs[DSP_ACEAH] << 16) | g_dsp.ifx_regs[DSP_ACEAL]; // Unused?
u32 Address = (g_dsp.ifx_regs[DSP_ACCAH] << 16) | g_dsp.ifx_regs[DSP_ACCAL];
+
switch (g_dsp.ifx_regs[DSP_FORMAT]) {
case 0xA: // u16 writes
DSPHost_WriteHostMemory(value >> 8, Address*2);
@@ -107,9 +110,10 @@ void dsp_write_aram_d3(u16 value)
Address++;
break;
default:
- ERROR_LOG(DSPLLE, "dsp_write_aram_d3: Unseen Format %i", g_dsp.ifx_regs[DSP_FORMAT]);
+ ERROR_LOG(DSPLLE, "dsp_write_aram_d3() - unknown format 0x%x", g_dsp.ifx_regs[DSP_FORMAT]);
break;
}
+
g_dsp.ifx_regs[DSP_ACCAH] = Address >> 16;
g_dsp.ifx_regs[DSP_ACCAL] = Address & 0xffff;
}
@@ -118,7 +122,6 @@ u16 dsp_read_accelerator()
{
const u32 EndAddress = (g_dsp.ifx_regs[DSP_ACEAH] << 16) | g_dsp.ifx_regs[DSP_ACEAL];
u32 Address = (g_dsp.ifx_regs[DSP_ACCAH] << 16) | g_dsp.ifx_regs[DSP_ACCAL];
-
u16 val;
// let's do the "hardware" decode DSP_FORMAT is interesting - the Zelda
@@ -139,42 +142,33 @@ u16 dsp_read_accelerator()
Address++;
break;
case 0x19: // 8-bit PCM audio
- val = DSPHost_ReadHostMemory(Address) << 8; // probably wrong
+ val = DSPHost_ReadHostMemory(Address) << 8;
g_dsp.ifx_regs[DSP_YN2] = g_dsp.ifx_regs[DSP_YN1];
g_dsp.ifx_regs[DSP_YN1] = val;
Address++;
break;
default:
- ERROR_LOG(DSPLLE, "Unknown DSP Format %x", g_dsp.ifx_regs[DSP_FORMAT]);
+ ERROR_LOG(DSPLLE, "dsp_read_accelerator() - unknown format 0x%x", g_dsp.ifx_regs[DSP_FORMAT]);
+ Address++;
val = 0;
+ break;
}
- // TODO: Take GAIN into account, whatever it is.
+ // TODO: Take GAIN into account
// adpcm = 0, pcm8 = 0x100, pcm16 = 0x800
// games using pcm8 : Phoenix Wright Ace Attorney (Wiiware), Megaman 9-10 (WiiWare)
- if (g_dsp.ifx_regs[DSP_GAIN] > 0)
- {
- //NOTICE_LOG(DSPLLE,"format: 0x%04x - val: 0x%04x - gain: 0x%04x", g_dsp.ifx_regs[DSP_FORMAT], val, g_dsp.ifx_regs[DSP_GAIN]);
- }
+ // games using pcm16: gc sega games, ...
// Check for loop.
+ // Somehow, YN1 and YN2 must be initialized with their "loop" values,
+ // so yeah, it seems likely that we should raise an exception to let
+ // the DSP program do that, at least if DSP_FORMAT == 0x0A.
if (Address >= EndAddress)
{
// Set address back to start address.
Address = (g_dsp.ifx_regs[DSP_ACSAH] << 16) | g_dsp.ifx_regs[DSP_ACSAL];
-
- // Do we really need both? (nakee: seems to cause problems with some
- // AX games)
- // DSPHost_InterruptRequest();
- // DSPCore_SetException(EXP_2);
DSPCore_SetException(EXP_ACCOV);
-
- // Somehow, YN1 and YN2 must be initialized with their "loop" values,
- // so yeah, it seems likely that we should raise an exception to let
- // the DSP program do that, at least if DSP_FORMAT == 0x0A.
}
- //else
- // DSPCore_SetException(EXP_6); // test! (bunch of NOPs there - helps "SMB S&R (wii)")
g_dsp.ifx_regs[DSP_ACCAH] = Address >> 16;
g_dsp.ifx_regs[DSP_ACCAL] = Address & 0xffff;
diff --git a/Source/Core/DSPCore/Src/DSPHWInterface.cpp b/Source/Core/DSPCore/Src/DSPHWInterface.cpp
index eb1f22da72..aea0aa70fd 100644
--- a/Source/Core/DSPCore/Src/DSPHWInterface.cpp
+++ b/Source/Core/DSPCore/Src/DSPHWInterface.cpp
@@ -136,7 +136,7 @@ void gdsp_ifx_write(u32 addr, u32 val)
if (val & 0x1)
DSPHost_InterruptRequest();
else
- WARN_LOG(DSPLLE, "Unknown Interrupt Request pc=%04x (%04x)", g_dsp.pc, val);
+ INFO_LOG(DSPLLE, "Unknown Interrupt Request pc=%04x (%04x)", g_dsp.pc, val);
break;
case DSP_DMBH:
diff --git a/Source/Core/DSPCore/Src/DspIntLoadStore.cpp b/Source/Core/DSPCore/Src/DspIntLoadStore.cpp
index 0801674138..b43d6707b3 100644
--- a/Source/Core/DSPCore/Src/DspIntLoadStore.cpp
+++ b/Source/Core/DSPCore/Src/DspIntLoadStore.cpp
@@ -191,7 +191,6 @@ void srri(const UDSPInstruction opc)
u8 sreg = opc & 0x1f;
u16 val = dsp_op_read_reg(sreg);
-
dsp_dmem_write(g_dsp.r.ar[dreg], val);
g_dsp.r.ar[dreg] = dsp_increment_addr_reg(dreg);
}
diff --git a/Source/Core/DSPCore/Src/DspIntMultiplier.cpp b/Source/Core/DSPCore/Src/DspIntMultiplier.cpp
index 9cdf0f06a0..fbde7a645c 100644
--- a/Source/Core/DSPCore/Src/DspIntMultiplier.cpp
+++ b/Source/Core/DSPCore/Src/DspIntMultiplier.cpp
@@ -173,6 +173,7 @@ void movpz(const UDSPInstruction opc)
// Adds secondary accumulator $axS to product register and stores result
// in accumulator register. Low 16-bits of $acD ($acD.l) are set (round) to 0.
//
+// TODO: ugly code and still small error here (+/- 1 in .m - randomly)
// flags out: --xx xx0x
void addpaxz(const UDSPInstruction opc)
{
@@ -367,7 +368,7 @@ void mulxmv(const UDSPInstruction opc)
Update_SR_Register64(dsp_get_long_acc(rreg));
}
-// MULXMV $ax0.S, $ax1.T, $acR
+// MULXMVZ $ax0.S, $ax1.T, $acR
// 101s t01r xxxx xxxx
// Move product register to accumulator register $acR and clear (round) low part
// of accumulator register $acR.l. Multiply one part $ax0 by one part $ax1