I've been making a GameBoy emulator, and I'm currently running it through the test ROMs located here.
One of the tests in cpu_instrs.zip
is as follows:
set_test 5,"POP AF"
ld bc,$1200
.loop:
push bc
pop af
push af
pop de
ld a,c
and $F0
cp e
jp nz,test_failed
inc b
inc c
jr nz,.loop
From what I understand, it seems like this test will always fail. On the first loop, the zero flag will not be set from inc c
and then the code will eventually jump to test_failed
since on the second loop, e
will equal 1 and a
will be 0.
What am I missing here?