Page 1 of 1

Vertical scrolling - PAL vs NTSC issues?

Posted: Sat Dec 12, 2015 12:22 am
by sav
First of all, since this is my first post - hi everyone!

I have a question about implementing vertical scrolling.
I was following the tutorial written by bunnyboy: http://nintendoage.com/auth/forum/messa ... adid=36958
I implemented the vertical scrolling in a very similar way to the horizontal scrolling that's implemented in the tutorial - initially I fill an entire nametable and the bottom row of the other one. I decrement the scrolling register by 1 in each frame. When it wraps to 255 I set it to 239 and swap the nametables. When the scroll register is a multiple of 8 I copy a new background row in the right place, and when it's a multiple of 32 I copy new attribute row.

Everything seems to be working fine when I was using the PAL emulation (I'm using FCEUXSDP, later I've also tried FCEUX and I saw the same issue). However when I've disabled the emulation, it stopped working - screen starts flickering, artifacts show up everywhere, and so on.

Does anyone know what may be causing this issue?

Re: Vertical scrolling - PAL vs NTSC issues?

Posted: Sat Dec 12, 2015 12:31 am
by rainwarrior
I'd guess that your nametable update during vblank (NMI routine) takes too long on NTSC. If you try to write to PPU registers outside of vblank, it conflicts with rendering (which needs exclusive use of the PPU) and corrupts the update. On PAL there is a much longer vblank, but on NTSC is it quite short.

You probably have a loop in your NMI routine that's copying bytes to the nametable via $2007; maybe you can optimize this to be fast enough to run within NTSC vblank?

Re: Vertical scrolling - PAL vs NTSC issues?

Posted: Sat Dec 12, 2015 12:42 am
by sav
Thanks for the response!

Yes, I am doing all the work with calculating source/destination addresses in NMI. Then I have a loop that copies that to the PPU.
I could probably buffer everything somewhere and then do the copy only in NMI. I guess that's the recommended way of doing that anyway.
I yet have to do this tutorial: http://wiki.nesdev.com/w/index.php/The_frame_and_NMIs. Maybe it will help.