DSPLLE: More minor clean up, some log mistake fixes and revert the +1 loop (it seems to got

zelda ucode stuck for some weird reason)


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3694 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-07-06 19:19:03 +00:00
parent c44dabfe8b
commit ce6e8ed798
7 changed files with 41 additions and 38 deletions

View file

@ -170,7 +170,7 @@ void DSPCore_CheckExternalInterrupt()
g_dsp.cr &= ~CR_EXTERNAL_INT;
} else {
#ifdef DEBUG_EXP
ERROR_LOG(DSPLLE, "External interupt firing failed");
ERROR_LOG(DSPLLE, "External interrupt firing failed");
#endif
}
@ -189,8 +189,8 @@ void DSPCore_CheckExceptions()
// check exceptions should it be 0..7 or 7..0?
for (int i = 0; i < 8; i++) {
// 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)) {
if (g_dsp.exceptions & (1 << i)) {
if (dsp_SR_is_flag_set(SR_INT_ENABLE) || i == EXP_INT) {
_assert_msg_(MASTER_LOG, !g_dsp.exception_in_progress_hack, "assert while exception");
// store pc and sr until RTI
@ -201,11 +201,11 @@ void DSPCore_CheckExceptions()
g_dsp.exceptions &= ~(1 << i);
g_dsp.exception_in_progress_hack = true;
break;
}
} else {
} else {
#ifdef DEBUG_EXP
ERROR_LOG(DSPLLE, "Firing exception %d failed");
ERROR_LOG(DSPLLE, "Firing exception %d failed");
#endif
}
}
}
}

View file

@ -92,7 +92,7 @@ void gdsp_mbox_write_l(u8 mbx, u16 val)
{
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(WM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.pc);
NOTICE_LOG(DSPLLE, "CPU(WM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_CPU), g_dsp.pc);
}
#endif
}
@ -121,7 +121,7 @@ u16 gdsp_mbox_read_l(u8 mbx)
{
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(RM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_DSP), g_dsp.pc);
NOTICE_LOG(DSPLLE, "CPU(RM) B:%i M:0x%08x (pc=0x%04x)", mbx, gdsp_mbox_peek(GDSP_MBOX_CPU), g_dsp.pc);
}
#endif

View file

@ -33,6 +33,7 @@
#include "DSPMemoryMap.h"
#include "DSPStacks.h"
// ---------------------------------------------------------------------------------------
// --- SR
// ---------------------------------------------------------------------------------------

View file

@ -71,34 +71,6 @@ u16 ReadCR()
return g_dsp.cr;
}
void HandleLoop()
{
// Handle looping hardware.
u16& rLoopCounter = g_dsp.r[DSP_REG_ST3];
if (rLoopCounter > 0)
{
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--;
if (rLoopCounter > 0)
{
g_dsp.pc = rCallAddress;
}
else
{
// end of loop
dsp_reg_load_stack(0);
dsp_reg_load_stack(2);
dsp_reg_load_stack(3);
}
}
}
}
void Step()
{
DSPCore_CheckExceptions();

View file

@ -27,6 +27,9 @@ namespace DSPInterpreter {
void Step();
void Run();
// See: DspIntBranch.cpp
void HandleLoop();
// If these simply return the same number of cycles as was passed into them,
// chances are that the DSP is halted.
// The difference between them is that the debug one obeys breakpoints.

View file

@ -145,6 +145,33 @@ void halt(const UDSPInstruction& opc)
// then PC is modified with calue from call stack $st0. Otherwise values from
// callstack $st0 and both loop stacks $st2 and $st3 are poped and execution
// continues at next opcode.
void HandleLoop()
{
// Handle looping hardware.
u16& rLoopCounter = g_dsp.r[DSP_REG_ST3];
if (rLoopCounter > 0)
{
const u16 rCallAddress = g_dsp.r[DSP_REG_ST0];
const u16 rLoopAddress = g_dsp.r[DSP_REG_ST2];
if (g_dsp.pc == (rLoopAddress + 1)) //opSize[rLoopAddress]))
{
rLoopCounter--;
if (rLoopCounter > 0)
{
g_dsp.pc = rCallAddress;
}
else
{
// end of loop
dsp_reg_load_stack(0);
dsp_reg_load_stack(2);
dsp_reg_load_stack(3);
}
}
}
}
// LOOP $R

View file

@ -6,11 +6,10 @@ files = [
"assemble.cpp",
"disassemble.cpp",
"DSPAccelerator.cpp",
"DSPBreakpoints.cpp",
"DSPBreakpoints.cpp",
"DSPIntCCUtil.cpp",
"DSPIntExtOps.cpp",
"DSPHWInterface.cpp",
"DSPInterpreter.cpp",
"DSPMemoryMap.cpp",
"DSPStacks.cpp",
"DSPAnalyzer.cpp",
@ -22,6 +21,7 @@ files = [
"DSPJit.cpp",
"DSPCodeUtil.cpp",
"LabelMap.cpp",
"DSPInterpreter.cpp",
"DSPCore.cpp",
"DSPTables.cpp",
]