projects
/
calu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sim: bugfix for overflow and so ...
[calu.git]
/
3b_sim
/
ccpu.cpp
diff --git
a/3b_sim/ccpu.cpp
b/3b_sim/ccpu.cpp
index 04dd5951b4021e13ac62a86bbd28f390a6af2983..abeeafd607c912e01402a9d889871895fe6bee49 100644
(file)
--- a/
3b_sim/ccpu.cpp
+++ b/
3b_sim/ccpu.cpp
@@
-127,8
+127,10
@@
void CCpu::updateFlags(CDatd val, CDat a, CDat b) {
this->m_Z = (val == 0);
this->m_S = ((val >> (BIT_LEN-1)) & 0x1);
this->m_C = ((val >> (BIT_LEN)) & 0x1);
this->m_Z = (val == 0);
this->m_S = ((val >> (BIT_LEN-1)) & 0x1);
this->m_C = ((val >> (BIT_LEN)) & 0x1);
- bool v = (((a ^ b) >> (BIT_LEN-1)) & 0x1) ? true : false;
- this->m_O = (this->m_S != v);
+ bool a_31 = ((a >> (BIT_LEN-1)) & 0x1);
+ bool b_31 = ((b >> (BIT_LEN-1)) & 0x1);
+ bool val_31 = ((val >> (BIT_LEN-1)) & 0x1);
+ this->m_O = ((a_31 && b_31 && !val_31) || (!a_31 && !b_31 && val_31));
}
void CCpu::updateCarry(bool c)
}
void CCpu::updateCarry(bool c)