emu_nes

An NES emulator for learning how the 6502 and similar computers of the era worked
Log | Files | Refs | README | LICENSE

commit 858cbfba48145ff9303a4127cb73911fc8904462
parent 76b9059b2e299dca5a96cf94f21038002f4dad3a
Author: vin <git@vineetk.net>
Date:   Sun,  9 Jun 2024 15:35:31 +0530

fix potential adc overflow flag bug

Diffstat:
Mcpu.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 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); }