From 7f1c27af75d8911333f7a2929b4f25a7add33bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kujawa?= Date: Sun, 12 Feb 2017 23:27:36 +0100 Subject: [PATCH] Fix carry flag handling for SBC. --- src/emulation.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/emulation.c b/src/emulation.c index 95aa1bb..0bf37b1 100644 --- a/src/emulation.c +++ b/src/emulation.c @@ -858,9 +858,9 @@ emul_sbc(rk65c02emu_t *e, void *id, instruction_t *i) if (e->regs.P & P_DECIMAL) if ((res > 99) || (res < 0)) - e->regs.P |= P_CARRY; - else e->regs.P &= ~P_CARRY; + else + e->regs.P |= P_CARRY; else /* if the result does not fit into 8 bits then clear carry */ if (res & 0x8000)