OSDN Git Service
(root)
/
motonesemu
/
motonesemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b9ed3cb
)
sbc v flag set bug fixed.
author
astoria-d
<astoria-d@mail.goo.ne.jp>
Tue, 13 Aug 2013 02:45:03 +0000
(11:45 +0900)
committer
astoria-d
<astoria-d@mail.goo.ne.jp>
Tue, 13 Aug 2013 02:45:03 +0000
(11:45 +0900)
emulator/6502core.c
patch
|
blob
|
history
diff --git
a/emulator/6502core.c
b/emulator/6502core.c
index
c5d78a1
..
f9a32ea
100644
(file)
--- a/
emulator/6502core.c
+++ b/
emulator/6502core.c
@@
-907,10
+907,12
@@
static void set_SUB_overflow(char d1, char d2, char d3) {
short d1_short = d1;
short d2_short = d2;
short d3_short = d3;
- if (d1_short >= d2_short + d3_short)
- cpu_reg.status.overflow = 0;
- else
+ if ((d1_short - d2_short - d3_short) > +127 || (d1_short - d2_short - d3_short) < -128 ){
cpu_reg.status.overflow = 1;
+ }
+ else {
+ cpu_reg.status.overflow = 0;
+ }
}
/*------------- stack operation.. ---------------------*/