scanline test happen exception

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
GZYangKui
Posts: 46
Joined: Wed Dec 21, 2022 6:54 am

scanline test happen exception

Post by GZYangKui »

Many games have been running normally, but I found a black box on the left during the scan line test. I ran the ROM through FCEUX to determine that it was the simulator fault, but I checked the PPU rendering related code and found no problem.github repository:https://github.com/GZYangKui/nes4j.Image
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: scanline test happen exception

Post by Quietust »

Based on your screenshot and some experiments I just did, it looks like your emulation of Sprite DMA (i.e. handling writes to $4014) isn't consuming the correct number of cycles - once the STA instruction finishes, it needs to consume an additional 512 cycles (since it's performing 256 reads and 256 writes) plus another 1-2 cycles of "synchronization" within the Sprite DMA logic.

Additionally, disabling Background rendering by toggling $2000.3 should display the background color (in this case, dark gray) rather than black.

Side note: that particular ROM is timed relative to NMI, so there'll be up to 3 CPU cycles worth jitter - if I had to do it again, I'd use the same technique as the full palette demo.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
Post Reply