jc-SpaceXp / cNES

NES emulator written in C and targeted for Linux.
zlib License
6 stars 4 forks source link

Ppu scrolling fix #2

Closed jc-SpaceXp closed 2 years ago

jc-SpaceXp commented 2 years ago

cNES now correctly scrolls the background tiles. Pretty much achieved in a similar way to how the NES hardware does it, using a 8x1 mux to select the correct bit from both background shift registers.

One potential issue of this PR is that the sprite 0 lookahead hit function will need to be modified in a similar way (99% sure of this). That change will come after this merge as the "ppu_scrolling_fix" branch has completed what it was set out to, fixing the palette issues from correctly scrolling the background.

jc-SpaceXp commented 2 years ago

Tested out these changes and haven't noticed any palette issues while scrolling. Changes seem good and rendering code is a bit more readable after adding a few new functions.