1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-21 23:29:16 +00:00

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.
This commit is contained in:
Peter Evans 2018-02-15 00:26:21 -06:00
parent 08b0e2e648
commit e415b3e490

View File

@ -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;
}
}