@pervognsen I don’t know about the NES but I can confirm that you can do infinite side scrolling in 2N space and infinite 2D scrolling in 2Mx2N space where M and N are height and width of the play area, using 2x or 4x replicating writes, respectively (spaced out over the play area) and then snapping the screen “back” when going off buffer.
Special hardware might simplify this further.
@pervognsen yes an MMU or some sort of address masking could both avoid replicating writes. Though on a charset-based display you’re 1D-scrolling in 24 chars or so, so you’re only optimizing away 24 extra replicating writes.
I actually never implemented an infinite scroller, just worked out the details from scratch for the Neversoft interview test ca. ~1994. No gimme questions back then! 🙂
@pervognsen The addressing basically wraps around left to right and top to bottom (with some quirks on the vertical). You get enough VRAM for two screens worth of tiles, and there's just a pin that specifies if they are laid out vertically or horizontally.
That's why some games had mild glitches at the screen edges when doing 4 way scrolling. If you use the vertical layout for example, then there are no offscreen tiles to swap when scrolling left and right.