From: Oliver Schmidt
Date: Tue, 21 May 2013 21:47:19 +0000 (+0200)
Subject: Fixed Carry handling in SBC opcode.
X-Git-Tag: V2.15~285
X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=129fcff7e5203560371b9feb77d2f6cf539b9421;p=cc65
Fixed Carry handling in SBC opcode.
---
diff --git a/src/sim65/6502.c b/src/sim65/6502.c
index bb357cbb7..f00aa3943 100644
--- a/src/sim65/6502.c
+++ b/src/sim65/6502.c
@@ -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); \