summaryrefslogtreecommitdiff
path: root/Source/Core/DSPCore/Src/DspIntBranch.cpp
diff options
context:
space:
mode:
authornakeee <nakeee@gmail.com>2009-07-06 19:19:03 +0000
committernakeee <nakeee@gmail.com>2009-07-06 19:19:03 +0000
commitce6e8ed798007545a42aaf36099176355d070003 (patch)
treeb50636732020c356489f07ac4a9aca4e01accf35 /Source/Core/DSPCore/Src/DspIntBranch.cpp
parentc44dabfe8b935da4a6b3970ffc0575d21f9f606d (diff)
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
Diffstat (limited to 'Source/Core/DSPCore/Src/DspIntBranch.cpp')
-rw-r--r--Source/Core/DSPCore/Src/DspIntBranch.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/Source/Core/DSPCore/Src/DspIntBranch.cpp b/Source/Core/DSPCore/Src/DspIntBranch.cpp
index 721428d8f0..7afa5d9585 100644
--- a/Source/Core/DSPCore/Src/DspIntBranch.cpp
+++ b/Source/Core/DSPCore/Src/DspIntBranch.cpp
@@ -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