From e415b3e4907a2e4e7f0ca262cd960883c20f3cd0 Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Thu, 15 Feb 2018 00:26:21 -0600 Subject: [PATCH] We should check only the first byte for zero We need to accept values for result that are greater than a byte so that we can determine if carry is set, but this causes an issue when an app uses addition to force an overflow that would set the zero bit. Masking result for only the LSB fixes that problem. --- src/mos6502.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mos6502.c b/src/mos6502.c index 5972831..6904833 100644 --- a/src/mos6502.c +++ b/src/mos6502.c @@ -271,7 +271,7 @@ mos6502_modify_status(mos6502 *cpu, vm_8bit status, int orig, int result) if (status & MOS_ZERO) { cpu->P &= ~MOS_ZERO; - if (result == 0) { + if ((result & 0xff) == 0) { cpu->P |= MOS_ZERO; } }