-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Description
I believe I've found a bug in ADC handling of N & Z flags in BCD mode:
the idea is to run this test:
; f8 38 a9 00 69 99
SED
SEC
LDA #$00
ADC #$99
So I run this piece of code:
from py65.devices.mpu65c02 import MPU as CMOS65C02
mpu = CMOS65C02()
mpu.memory = 0x10000 * [0xEA]
mpu.p |= mpu.DECIMAL
mpu.p |= mpu.CARRY
mpu.pc = 0x0000
mpu.a = 0
mpu.memory[0x0000]=0x69
mpu.memory[0x0001]=0x99
mpu.step()
which result in:
PC AC XR YR SP NV-BDIZC
65C02: 0002 00 00 00 ff 10111001
Accumulator is correctly set to 00 but the Z and N flags seem to have incorrect values.
Running the same test in Easy6502 (https://skilldrick.github.io/easy6502/), and Visual6502 (http://www.visual6502.org/JSSim/expert.html) return:
NV-BDIZC A=$00 X=$00 Y=$00
00111011
so here N is not set (expected), and Z is set.
Metadata
Metadata
Assignees
Labels
No labels