summaryrefslogtreecommitdiff
path: root/Source/Core/DSPCore/Src/DSPStacks.cpp
diff options
context:
space:
mode:
authorhrydgard <hrydgard@gmail.com>2009-06-28 10:24:44 +0000
committerhrydgard <hrydgard@gmail.com>2009-06-28 10:24:44 +0000
commit5c7fc8ed7b66c864a0cfe27cf451f43b68f9a856 (patch)
treee617bae0df96a6b976e6c6437cc2774fad223d81 /Source/Core/DSPCore/Src/DSPStacks.cpp
parent895b02f4102885d8ab8c4419d76dfef7f4c21703 (diff)
DSP: build fixin', more movin', some comments.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3564 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DSPCore/Src/DSPStacks.cpp')
-rw-r--r--Source/Core/DSPCore/Src/DSPStacks.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/Source/Core/DSPCore/Src/DSPStacks.cpp b/Source/Core/DSPCore/Src/DSPStacks.cpp
new file mode 100644
index 0000000000..af9f74c18d
--- /dev/null
+++ b/Source/Core/DSPCore/Src/DSPStacks.cpp
@@ -0,0 +1,59 @@
+/*====================================================================
+
+ filename: gdsp_registers.cpp
+ project: GCemu
+ created: 2004-6-18
+ mail: duddie@walla.com
+
+ Copyright (c) 2005 Duddie & Tratax
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ ====================================================================*/
+
+#include "Common.h"
+
+#include "DSPCore.h"
+// #include "DSPInterpreter.h"
+#include "DSPStacks.h"
+
+// Stacks. The stacks are outside the DSP RAM, in dedicated hardware.
+
+void dsp_reg_stack_push(u8 stack_reg)
+{
+ g_dsp.reg_stack_ptr[stack_reg]++;
+ g_dsp.reg_stack_ptr[stack_reg] &= DSP_STACK_MASK;
+ g_dsp.reg_stack[stack_reg][g_dsp.reg_stack_ptr[stack_reg]] = g_dsp.r[DSP_REG_ST0 + stack_reg];
+}
+
+void dsp_reg_stack_pop(u8 stack_reg)
+{
+ g_dsp.r[DSP_REG_ST0 + stack_reg] = g_dsp.reg_stack[stack_reg][g_dsp.reg_stack_ptr[stack_reg]];
+ g_dsp.reg_stack_ptr[stack_reg]--;
+ g_dsp.reg_stack_ptr[stack_reg] &= DSP_STACK_MASK;
+}
+
+void dsp_reg_store_stack(u8 stack_reg, u16 val)
+{
+ dsp_reg_stack_push(stack_reg);
+ g_dsp.r[DSP_REG_ST0 + stack_reg] = val;
+}
+
+u16 dsp_reg_load_stack(u8 stack_reg)
+{
+ u16 val = g_dsp.r[DSP_REG_ST0 + stack_reg];
+ dsp_reg_stack_pop(stack_reg);
+ return val;
+}