1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-11 18:49:16 +00:00

Fix carry flag handling for SBC.

This commit is contained in:
Radosław Kujawa 2017-02-12 23:27:36 +01:00
parent 78b6ddc286
commit 7f1c27af75

View File

@ -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)