Scenario:I have a sprite in the center of the screen. The background x and y scroll is updated by the controller. I allow to scroll infinitely in any direction. The background continues to repeat (which is what I want.) I've experimented with 4 way mirroring and loading the same nametable into each of the 4 nametable addresses so the image always repeats.

Problem:I notice that when I scroll horizontal the image repeats with no issue but when I continue to scroll vertical a set of artifacts appears on the top of the screen that appear to be generated by the PPU and not from any graphics in my .chr file. When y reaches between 240-255 the artifacts appear. I believe it has something to do with x being from 0-255 and the size of the nametable for y is 0-239.

Question:How can I scroll in any direction for any length of distance and have a background continue to repeat without seeing the artifacts I mention above?

"Negative scrolling" is badly worded for what happens there. A more accurate description would be "scroll into the attribute table", where the AT data is displayed on the screen as NT data. I'm not saying this feaure doesn't have any applications, but so far I didn't find any so if there is any use to this it is in extremely weird/special cases.

For instance if you badly needed a 32x32 tile map and would be ready to sacrifice coulours for it, you could set all 4 BG palettes to the same values and use AT as NT, to get the required 32x32 map.

In typically scrolling case, you do not want to do that, and want to go from 239 to 0 directly.

After incrementing the Y scroll, check if it's larger than 239. If so, add 16 to force a wrap to the next screen, skipping over the attribute tables. After decrementing it, check if it underflowed below 0, and subtract 16 if that's the case.

Thanks. This ended up working. I use #$ef instead of #$f0 because you start to see the attribute table starting at #$f0 (240). I had seen the + method used before but didn't understand it. Now I do. It enabled me to jump the instruction (I'm pretty new at this).

I was adding 16 to 240 or subtracting 16 from an undersigned value (<0) to make it work before. This allowed me to skip the attribute table that was showing. Can someone help me understand why adding or subtracting (depending on the controller direction) 239 to 239 works?

Who is online

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum