thefox wrote:
Create a trace log from a power-on, then from a soft reset. See where they diverge.
Code:
BFC8 CA DEX A:0B X:B3 Y:01 P:A5 SP:FB CYC:302 SL:240
BFC9 D0 FD BNE $BFC8 A:0B X:B3 Y:01 P:A5 SP:FB CYC:308 SL:240
BFC8 CA DEX A:0B X:B2 Y:01 P:A5 SP:FB CYC:317 SL:240
BFC9 D0 FD BNE $BFC8 A:0B X:B2 Y:01 P:A5 SP:FB CYC:323 SL:240
BFC8 CA DEX A:0B X:B1 Y:01 P:A5 SP:FB CYC:332 SL:240
BFC9 D0 FD BNE $BFC8 A:0B X:B1 Y:01 P:A5 SP:F8 CYC:338 SL:240
0300 4C 1A FC JMP $FC1A A:0B X:B1 Y:01 P:A5 SP:F8 CYC: 27 SL:241
FC1A A6 21 LDX $21 = FA A:0B X:FA Y:01 P:A5 SP:F8 CYC: 36 SL:241
FC1C 9A TXS A:0B X:FA Y:01 P:A5 SP:FA CYC: 45 SL:241
FC1D 6C 03 03 JMP ($0303) = 9EC7 A:0B X:FA Y:01 P:A5 SP:FA CYC: 51 SL:241
9EC7 33 99 RLA ($99),Y = 0000 @ 0001 = 78 A:01 X:FA Y:01 P:24 SP:FA CYC: 66 SL:241
9EC9 CC E6 72 CPY $72E6 = 00 A:01 X:FA Y:01 P:25 SP:FA CYC: 90 SL:241
9ECC 90 3C BCC $9F0A A:01 X:FA Y:01 P:25 SP:FA CYC:102 SL:241
9ECE 18 CLC A:01 X:FA Y:01 P:24 SP:FA CYC:108 SL:241
9ECF 00 BRK A:01 X:FA Y:01 P:24 SP:F7 CYC:114 SL:241
FFFF FF 00 F1 ISB $F100,X @ F1FA = 53 A:AC X:FA Y:01 P:A4 SP:F7 CYC:135 SL:241
The deviation happens at that spontaneous jump to $0300. From the SL, it coincides with NMI. Prior to the jump, it was in loop that was decrementing X to 0. I will keep investigating.
Edit:
The last bank in mapper 71 is fixed. Here is the NMI address:
Code:
0F:FFFA:00 BRK
0F:FFFB:03 UNDEFINED
NMI directs execution to code loaded into RAM.
Edit 2:
I can fix the problem by writing $00 to the PPU CTRL register ($2000) on reset, disabling NMI's. Should that be happening?