3 ms·
Not sure historically but at least doing some OLED programming these days it's often the case they support changing where the pointer starts (in terms of rows o
by junon 3y ago
Not sure historically but at least doing some OLED programming these days it's often the case they support changing where the pointer starts (in terms of rows or columns) and allowing the behavior of wrapping the cursor around, meaning that when you'd do a full scroll the rows simply wrap around. If you don't overwrite anything in the video memory, then you just see the content from the top/bottom show up at the bottom/top, but if you did (e.g. to implement efficient whole-screen scrolling) you just had to re-paint the lines that were offset, instead of the whole screen.
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).
- toast0 3y agoYou can set the Start Address to shift the display [1], I haven't used this in graphics mode, but in text mode, if you set the line offset to 128, in 80x25 mode, you get easy scrolling (still line based though) with wrap around or you can use the offset register to start at 0 at a given scanline [2]. I think I picked up this technique from this article [3] 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 http://www.osdever.net/FreeVGA/vga/crtcreg.htm#0C [2] http://www.osdever.net/FreeVGA/vga/crtcreg.htm#13 http://www.osdever.net/FreeVGA/vga/crtcreg.htm#13 [3] http://www.os2museum.com/wp/dosv-graphics-text-modes-and-scrolling/ http://www.os2museum.com/wp/dosv-graphics-text-modes-and-scr... [4] http://www.osdever.net/FreeVGA/vga/crtcreg.htm#08 http://www.osdever.net/FreeVGA/vga/crtcreg.htm#08
- junon 3y agoOh wow thanks, these are great links!