summaryrefslogtreecommitdiff
path: root/Source/Core/DSPCore
diff options
context:
space:
mode:
authornakeee <nakeee@gmail.com>2009-09-07 10:46:22 +0000
committernakeee <nakeee@gmail.com>2009-09-07 10:46:22 +0000
commit49601e0af2104eb0daca32d54840bc60bfea377f (patch)
treec1781d70b9b409f909a7ef3ef8776d1957210830 /Source/Core/DSPCore
parent4c36a5280c760d5acf7fd4840328306701deebc2 (diff)
DSPLLE added carry and overflow now we (lordmark) should add them in
the right ops ;) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4222 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DSPCore')
-rw-r--r--Source/Core/DSPCore/Src/DSPIntCCUtil.cpp25
-rw-r--r--Source/Core/DSPCore/Src/DSPIntCCUtil.h16
2 files changed, 36 insertions, 5 deletions
diff --git a/Source/Core/DSPCore/Src/DSPIntCCUtil.cpp b/Source/Core/DSPCore/Src/DSPIntCCUtil.cpp
index 147c239f71..42ec92e4a6 100644
--- a/Source/Core/DSPCore/Src/DSPIntCCUtil.cpp
+++ b/Source/Core/DSPCore/Src/DSPIntCCUtil.cpp
@@ -26,7 +26,7 @@
namespace DSPInterpreter {
-void Update_SR_Register64(s64 _Value)
+void Update_SR_Register64(s64 _Value, bool carry, bool overflow)
{
// TODO: Should also set 0x10 and 0x01 (also 0x02?)
g_dsp.r[DSP_REG_SR] &= ~SR_CMP_MASK;
@@ -41,6 +41,16 @@ void Update_SR_Register64(s64 _Value)
g_dsp.r[DSP_REG_SR] |= SR_ARITH_ZERO;
}
+ if (carry)
+ {
+ g_dsp.r[DSP_REG_SR] |= SR_CARRY;
+ }
+
+ if (overflow)
+ {
+ g_dsp.r[DSP_REG_SR] |= SR_OVERFLOW;
+ }
+
// Checks if top bits are equal, what is it good for?
if (((_Value >> 62) == 0) || (_Value >> 62 == 3))
{
@@ -49,11 +59,10 @@ void Update_SR_Register64(s64 _Value)
}
-void Update_SR_Register16(s16 _Value)
+void Update_SR_Register16(s16 _Value, bool carry, bool overflow)
{
g_dsp.r[DSP_REG_SR] &= ~SR_CMP_MASK;
- // Only sets those 3 bits
if (_Value < 0)
{
@@ -65,6 +74,16 @@ void Update_SR_Register16(s16 _Value)
g_dsp.r[DSP_REG_SR] |= SR_ARITH_ZERO;
}
+ if (carry)
+ {
+ g_dsp.r[DSP_REG_SR] |= SR_CARRY;
+ }
+
+ if (overflow)
+ {
+ g_dsp.r[DSP_REG_SR] |= SR_OVERFLOW;
+ }
+
// Checks if top bits are equal, what is it good for?
if (((_Value >> 14) == 0) || ((_Value >> 14) == 3))
{
diff --git a/Source/Core/DSPCore/Src/DSPIntCCUtil.h b/Source/Core/DSPCore/Src/DSPIntCCUtil.h
index b05dacedd6..391e30b2bc 100644
--- a/Source/Core/DSPCore/Src/DSPIntCCUtil.h
+++ b/Source/Core/DSPCore/Src/DSPIntCCUtil.h
@@ -30,10 +30,22 @@ bool CheckCondition(u8 _Condition);
int GetMultiplyModifier();
-void Update_SR_Register16(s16 _Value);
-void Update_SR_Register64(s64 _Value);
+void Update_SR_Register16(s16 _Value, bool carry = false, bool overflow = false);
+void Update_SR_Register64(s64 _Value, bool carry = false, bool overflow = false);
void Update_SR_LZ(s64 value);
+inline bool isAddCarry(u64 val, u64 result) {
+ return (val > result);
+}
+
+inline bool isSubCarry(u64 val, u64 result) {
+ return (val < result);
+}
+
+inline bool isOverflow(s64 val1, s64 val2, s64 res) {
+ return ((val1 ^ res) & (val2 ^ res)) < 0;
+}
+
} // namespace
#endif // _GDSP_CONDITION_CODES_H