diff --git a/cpu.c b/cpu.c index 4aeaaf6..3bbfc42 100644 --- a/cpu.c +++ b/cpu.c @@ -120,7 +120,7 @@ adc(uint8_t arg) regs.status.carry = sum > 0xFF; /* overflow flag formula: https://stackoverflow.com/a/29224684 */ - regs.status.overflow = ~(regs.a ^ arg) & (regs.a ^ sum) & 0x80; + regs.status.overflow = (~(regs.a ^ arg) & (regs.a ^ sum) & 0x80) > 0; STATUS_UPDATE_ZERO(regs.a); STATUS_UPDATE_NEGATIVE(regs.a); }