]> git.sur5r.net Git - cc65/commitdiff
Fixed Carry handling in SBC opcode.
authorOliver Schmidt <ol.sc@web.de>
Tue, 21 May 2013 21:47:19 +0000 (23:47 +0200)
committerOliver Schmidt <ol.sc@web.de>
Tue, 21 May 2013 21:47:19 +0000 (23:47 +0200)
src/sim65/6502.c

index bb357cbb7845b7406eb5c018492ac5522572479e..f00aa3943abdb7a76c963f1d761bafefee8fa0ed 100644 (file)
@@ -312,7 +312,7 @@ static unsigned HaveIRQRequest;
             SET_CF (res <= 0xFF);                               \
             SET_OF (((old^rhs) & (old^res) & 0x80));            \
         } else {                                                \
-            Regs.AC -= rhs - (!GET_CF ());                      \
+            Regs.AC -= rhs + (!GET_CF ());                      \
             TEST_ZF (Regs.AC);                                  \
             TEST_SF (Regs.AC);                                  \
             SET_CF (Regs.AC <= 0xFF);                           \