Hacker News new | past | comments | ask | show | jobs | submit
Simplified:

Three regions that move as you scroll in x/y: current/next/clean.

The key is that when you scroll a column or a line, that column/line is written in all three regions.

The clean region is used both as a source for filling the dirty places where sprites have been written as well as the next current or next after a wrap.

VGA registers take care of the x, y start output.

Why would writing three regions be faster than writing one though?
It allows for infinite scroll in x/y directions with only (3x) incremental paints of new columns/lines without:

a) needing to redraw a full screen when you reach the end of the buffer/region "ring"

or

b) relying on VGA 64k address wrapping (fiddly, doesn't work the same with all cards, doesn't allow you to use a split screen for a stationary lower status bar).

You need two regions for double buffering, giving you more paint time for all those sprites and one more for the wrapping trick. As you move around these three regions swap roles.