Argh! Started adding the shell of a PPU and now none of blargg's tests pass at all. (See example below). This makes no sense to me at all, because I can pass nestest.nes with flying colors until the undocumented instructions - about 5260 instructions in.
I'm guessing that I'm fouling up one instruction slightly that is in the harness of blargg's tests that is causing it to fail the tests even when they would pass. I tried comparing a nintendulator log with my run, but the comparison gets all fouled up because the test is banging the PPU:
(There's something I don't understand in this snippet where nintendulator does NOT set the negative flag on P after doing a BIT on $FF and $00 but then DOES set the negative flag a few instructions later doing the exact same thing. Is nintendulator lying about the value returned from the PPU? ($2002)).
I tried debugging the instruction test by hand, but it seems impossible. Does anyone know what I might be getting wrong to trip up blargg's tests but not nestest.nes? Any suggestions for alternate debug paths? Is there a way to whip up a version of the tests that don't access the PPU at all, so I could compare with nintendulator?
Aside from all that, I can run Donkey Kong with my faux PPU at least far enough to watch it set the different registers, throw data at it for the name tables and image/sprite palettes, and ask for DMA transfers.
// Failed instruction test:
2A ROL A
0A ASL A
6A ROR A
4A LSR A
8A TXA
98 TYA
AA TAX
A8 TAY
E8 INX
C8 INY
CA DEX
88 DEY
38 SEC
18 CLC
F8 SED
D8 CLD
58 CLI
B8 CLV
EA NOP
1A NOP
3A NOP
5A NOP
7A NOP
DA NOP
FA NOP
01-implied
Failed
I'm guessing that I'm fouling up one instruction slightly that is in the harness of blargg's tests that is causing it to fail the tests even when they would pass. I tried comparing a nintendulator log with my run, but the comparison gets all fouled up because the test is banging the PPU:
Code:
E947 2C 02 20 BIT $2002 = FF A:00 X:31 Y:15 P:24 SP:FB CYC:300 SL:240
E94A 30 06 BMI $E952 A:00 X:31 Y:15 P:26 SP:FB CYC:312 SL:240
E94C CA DEX A:00 X:31 Y:15 P:26 SP:FB CYC:318 SL:240
E94D D0 F8 BNE $E947 A:00 X:30 Y:15 P:24 SP:FB CYC:324 SL:240
E947 2C 02 20 BIT $2002 = FF A:00 X:30 Y:15 P:24 SP:FB CYC:333 SL:240
E94A 30 06 BMI $E952 A:00 X:30 Y:15 P:A6 SP:FB CYC: 4 SL:241
E94A 30 06 BMI $E952 A:00 X:31 Y:15 P:26 SP:FB CYC:312 SL:240
E94C CA DEX A:00 X:31 Y:15 P:26 SP:FB CYC:318 SL:240
E94D D0 F8 BNE $E947 A:00 X:30 Y:15 P:24 SP:FB CYC:324 SL:240
E947 2C 02 20 BIT $2002 = FF A:00 X:30 Y:15 P:24 SP:FB CYC:333 SL:240
E94A 30 06 BMI $E952 A:00 X:30 Y:15 P:A6 SP:FB CYC: 4 SL:241
(There's something I don't understand in this snippet where nintendulator does NOT set the negative flag on P after doing a BIT on $FF and $00 but then DOES set the negative flag a few instructions later doing the exact same thing. Is nintendulator lying about the value returned from the PPU? ($2002)).
I tried debugging the instruction test by hand, but it seems impossible. Does anyone know what I might be getting wrong to trip up blargg's tests but not nestest.nes? Any suggestions for alternate debug paths? Is there a way to whip up a version of the tests that don't access the PPU at all, so I could compare with nintendulator?
Aside from all that, I can run Donkey Kong with my faux PPU at least far enough to watch it set the different registers, throw data at it for the name tables and image/sprite palettes, and ask for DMA transfers.
// Failed instruction test:
2A ROL A
0A ASL A
6A ROR A
4A LSR A
8A TXA
98 TYA
AA TAX
A8 TAY
E8 INX
C8 INY
CA DEX
88 DEY
38 SEC
18 CLC
F8 SED
D8 CLD
58 CLI
B8 CLV
EA NOP
1A NOP
3A NOP
5A NOP
7A NOP
DA NOP
FA NOP
01-implied
Failed