4 ms·
The NES designers goofed and made the size of the view window (nametable) 240 pixels tall. This makes vertical scrolling awkward as it throws a non-power-of-two
by pubby 7y ago
The NES designers goofed and made the size of the view window (nametable) 240 pixels tall. This makes vertical scrolling awkward as it throws a non-power-of-two divisor into the math. The NES doesn't have a division instruction - only bit shifts, so having to divide by 240 is a real pain!
Also, Y-scrolling wasn't completely figured out until late in the NES's life. The register writes needed to do so are very strange, and Zelda certainly doesn't do it correctly!
- simcop2387 7y agoI believe that's one of the reasons that games such as Super Mario Bros 3 used additional hardware in the cartridge to do the y scrolling. The memory mapper had special support for just y scrolling and scanline counting. http://wiki.nesdev.com/w/index.php/MMC3 http://wiki.nesdev.com/w/index.php/MMC3
- pubby 7y agoOh, you don't need special hardware to do y-scrolling correctly. It's just a strange set of writes: $2006, $2005, $2005, $2006. MMC3 is for the scanline counter, which allowed SMB3 to have the score bar on the bottom of the screen.
- kgabis 7y agoThe way this scanline counter was implemented is quite clever. From nesdev wiki (https://wiki.nesdev.com/w/index.php/MMC3 https://wiki.nesdev.com/w/index.php/MMC3): The counter is based on the following trick: whenever rendering is turned on in the PPU, it fetches nametable and BG pattern tiles from dots 0-255 and 320-340 of a scanline and fetches sprite patterns from dots 256-319, even if no sprites are visible. Because of this, if BG uses the left pattern table ($0000), and if sprites always use the right pattern table ($1000), A12 will remain low during all nametable and BG pattern fetches, and high during all sprite pattern fetches, causing it to oscillate exactly one time per scanline and 241 times per frame.
- bonzini 7y agoYou can probably do it without divisions if you use the name table creatively... You can place line 720 of the input at line 192 of the name table (720 modulo 256 is 192) as long as everything above and below it is displayed correctly.