mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
DSPLLE: comments and logging clean up
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3693 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -106,12 +106,12 @@ u16 dsp_read_accelerator()
|
||||
|
||||
u16 val;
|
||||
|
||||
// let's do the "hardware" decode
|
||||
// DSP_FORMAT is interesting - the Zelda ucode seems to indicate that the bottom
|
||||
// two bits specify the "read size" and the address multiplier.
|
||||
// The bits above that may be things like sign extention and do/do not use ADPCM.
|
||||
// It also remains to be figured out whether there's a difference between the usual
|
||||
// accelerator "read address" and 0xd3.
|
||||
// let's do the "hardware" decode DSP_FORMAT is interesting - the Zelda
|
||||
// ucode seems to indicate that the bottom two bits specify the "read size"
|
||||
// and the address multiplier. The bits above that may be things like sign
|
||||
// extention and do/do not use ADPCM. It also remains to be figured out
|
||||
// whether there's a difference between the usual accelerator "read
|
||||
// address" and 0xd3.
|
||||
switch (gdsp_ifx_regs[DSP_FORMAT])
|
||||
{
|
||||
case 0x00: // ADPCM audio
|
||||
@ -146,9 +146,9 @@ u16 dsp_read_accelerator()
|
||||
DSPCore_SetException(EXP_4);
|
||||
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.
|
||||
// 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.
|
||||
}
|
||||
|
||||
gdsp_ifx_regs[DSP_ACCAH] = Address >> 16;
|
||||
|
@ -153,51 +153,59 @@ void DSPCore_SetException(u8 level)
|
||||
g_dsp.exceptions |= 1 << level;
|
||||
}
|
||||
|
||||
// Comming from the CPU
|
||||
void DSPCore_CheckExternalInterrupt()
|
||||
{
|
||||
// check if there is an external interrupt
|
||||
if (g_dsp.cr & CR_EXTERNAL_INT && !g_dsp.exception_in_progress_hack)
|
||||
{
|
||||
#ifdef DEBUG_EXP
|
||||
NOTICE_LOG(DSPLLE, "trying External interupt fired");
|
||||
NOTICE_LOG(DSPLLE, "Firing external interrupt");
|
||||
#endif
|
||||
if (dsp_SR_is_flag_set(SR_EXT_INT_ENABLE))
|
||||
{
|
||||
#ifdef DEBUG_EXP
|
||||
NOTICE_LOG(DSPLLE, "External interupt fired");
|
||||
#endif
|
||||
// level 7 is the interrupt exception
|
||||
// Signal the SPU about new mail
|
||||
DSPCore_SetException(EXP_INT);
|
||||
|
||||
g_dsp.cr &= ~CR_EXTERNAL_INT;
|
||||
} else {
|
||||
#ifdef DEBUG_EXP
|
||||
ERROR_LOG(DSPLLE, "External interupt firing failed");
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void DSPCore_CheckExceptions()
|
||||
{
|
||||
// it's unclear what to do when there are two exceptions are the same time
|
||||
// but for sure they should not be called together therefore the
|
||||
// g_dsp.exception_in_progress_hack
|
||||
if (g_dsp.exceptions != 0 && !g_dsp.exception_in_progress_hack) {
|
||||
#ifdef DEBUG_EXP
|
||||
NOTICE_LOG(DSPLLE, "trying exception %d fired", g_dsp.exceptions);
|
||||
NOTICE_LOG(DSPLLE, "Firing exception %d", g_dsp.exceptions);
|
||||
#endif
|
||||
// check exceptions
|
||||
// check exceptions should it be 0..7 or 7..0?
|
||||
for (int i = 0; i < 8; i++) {
|
||||
// Seems 7 must pass or zelda dies
|
||||
// Seems exp int is not masked by sr_int_enable
|
||||
if (dsp_SR_is_flag_set(SR_INT_ENABLE) || i == EXP_INT) {
|
||||
if (g_dsp.exceptions & (1 << i)) {
|
||||
_assert_msg_(MASTER_LOG, !g_dsp.exception_in_progress_hack, "assert while exception");
|
||||
|
||||
// store pc and sr until RTI
|
||||
dsp_reg_store_stack(DSP_STACK_C, g_dsp.pc);
|
||||
dsp_reg_store_stack(DSP_STACK_D, g_dsp.r[DSP_REG_SR]);
|
||||
|
||||
g_dsp.pc = i * 2;
|
||||
g_dsp.pc = i * 2;
|
||||
g_dsp.exceptions &= ~(1 << i);
|
||||
#ifdef DEBUG_EXP
|
||||
NOTICE_LOG(DSPLLE, "exception %d fired");
|
||||
#endif
|
||||
g_dsp.exception_in_progress_hack = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
#ifdef DEBUG_EXP
|
||||
ERROR_LOG(DSPLLE, "Firing exception %d failed");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,14 +90,9 @@ void gdsp_mbox_write_l(u8 mbx, u16 val)
|
||||
#ifdef DEBUG_EXP
|
||||
if (mbx == GDSP_MBOX_DSP)
|
||||
{
|
||||
NOTICE_LOG(DSPLLE, " - DSP writes mail to mbx low %i: 0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.pc);
|
||||
//DSPHost_InterruptRequest();
|
||||
//DSPCore_SetException(EXP_INT);
|
||||
NOTICE_LOG(DSPLLE, "DSP(WM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.pc);
|
||||
} else {
|
||||
NOTICE_LOG(DSPLLE, " - CPU writes mail to mbx low %i: 0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_CPU), g_dsp.pc);
|
||||
|
||||
// DSPHost_InterruptRequest();
|
||||
// DSPCore_SetException(EXP_INT);
|
||||
NOTICE_LOG(DSPLLE, "CPU(WM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.pc);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -124,13 +119,9 @@ u16 gdsp_mbox_read_l(u8 mbx)
|
||||
#ifdef DEBUG_EXP
|
||||
if (mbx == GDSP_MBOX_DSP)
|
||||
{
|
||||
NOTICE_LOG(DSPLLE, "- DSP reads mail from mbx %i: %08x (pc=0x%04x)", mbx, gdsp_mbox_peek(mbx), g_dsp.pc);
|
||||
// DSPCore_SetException(EXP_INT);
|
||||
// DSPHost_InterruptRequest();
|
||||
NOTICE_LOG(DSPLLE, "DSP(RM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.pc);
|
||||
} else {
|
||||
NOTICE_LOG(DSPLLE, "- CPU reads mail from mbx %i: %08x (pc=0x%04x)", mbx, gdsp_mbox_peek(mbx), g_dsp.pc);
|
||||
// DSPCore_SetException(EXP_INT);
|
||||
// DSPHost_InterruptRequest();
|
||||
NOTICE_LOG(DSPLLE, "CPU(RM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.pc);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -80,6 +80,7 @@ void HandleLoop()
|
||||
const u16 rCallAddress = g_dsp.r[DSP_REG_ST0];
|
||||
const u16 rLoopAddress = g_dsp.r[DSP_REG_ST2];
|
||||
|
||||
|
||||
if (g_dsp.pc == (rLoopAddress + opSize[rLoopAddress]))
|
||||
{
|
||||
rLoopCounter--;
|
||||
@ -148,7 +149,8 @@ void Run()
|
||||
// This one has basic idle skipping, and checks breakpoints.
|
||||
int RunCyclesDebug(int cycles)
|
||||
{
|
||||
// First, let's run a few cycles with no idle skipping so that things can progress a bit.
|
||||
// First, let's run a few cycles with no idle skipping so that things can
|
||||
// progress a bit.
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (g_dsp.cr & CR_HALT)
|
||||
@ -231,7 +233,8 @@ int RunCycles(int cycles)
|
||||
cycles--;
|
||||
}
|
||||
|
||||
// Next, let's run a few cycles with idle skipping, so that we can skip idle loops.
|
||||
// Next, let's run a few cycles with idle skipping, so that we can skip
|
||||
// idle loops.
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (g_dsp.cr & CR_HALT)
|
||||
@ -242,8 +245,9 @@ int RunCycles(int cycles)
|
||||
cycles--;
|
||||
}
|
||||
|
||||
// Now, run the rest of the block without idle skipping. It might trip into a
|
||||
// idle loop and if so we waste some time here. Might be beneficial to slice even further.
|
||||
// Now, run the rest of the block without idle skipping. It might trip into
|
||||
// a idle loop and if so we waste some time here. Might be beneficial to
|
||||
// slice even further.
|
||||
while (cycles > 0)
|
||||
{
|
||||
Step();
|
||||
|
Reference in New Issue
Block a user