by Pinus · 2y ago · 0 comments
Anyway, what I don't remember is: Could typical hardware terminals do this with a scroll region, or only with the whole screen? For a full-screen scroll, I suppose one could quite easily move everything by gradually offsetting the vertical sync a bit, but for a block of lines there would have to be something more complicated, like offsetting the input to the character generators for some scan lines. Is that what they did?
NES (a 6502, if it matters) had a different approach, where you had four sections with their own memory regions for tiles and sprites. You'd then tell the NES how to lay them out, e.g. if they were next to each other, how they'd wrap, if one was duplicated to another slot, etc and then the scrolling was handled by hardware. This is how Super Mario implemented the long sprawling levels (and I believe why the first wouldn't let you go back).
As for e.g. VGA buffers on x86 for example, as far as I know there's no (standard) way to have them shift. I could be wrong. However I've had to write a few vertical scroller rasterizers before for VGA buffers and I've always done them manually, usually with some cleverness to avoid actually writing to the buffer when it wasn't necessary (since that hit a memory mapped region and thus was much slower than RAM).
Edit to add; looks like you can do line based scrolling in text mode with the Preset Row Scan register [4].
Edit to add again; I think there's similar stuff in Vesa Bios Extensions (i set a SetDisplayStart, but I'm not sure I see a equivalent to the offset register), but if you're using a UEFI GOP framebuffer, I don't think there's anything similar, and you have to manage scrolling yourself. :(
[1] http://www.osdever.net/FreeVGA/vga/crtcreg.htm#0C
[2] http://www.osdever.net/FreeVGA/vga/crtcreg.htm#13
[3] http://www.os2museum.com/wp/dosv-graphics-text-modes-and-scr...