Page 1 of 1

Scroll section of screen

Posted: Tue Feb 07, 2012 6:43 pm
by GAT
I am trying to scroll just a section of the screen in video mode 13h using x86 asm.
I am trying to set it up so that text output will be restricted to part of the screen, and instead of it going out of the section of screen, the section would scroll up.
Any ideas?

Re: Scroll section of screen

Posted: Tue Feb 07, 2012 8:31 pm
by neon
Hello,

There are a number of ways to do this. Due to you only wanting to scroll a rectangular region, you can scroll by just rendering the text to a backbuffer and render it to display, clipping it at the borders of the display region. Alternatively, implement a text region GUI object that allows rendering a text font. The text region GUI object would clip the font to the border edges when drawing the font.

I can provide some sample code -- but the code for this really depends on your GUIs design. I do assume you have a GUI on top of your graphics driver.

Re: Scroll section of screen

Posted: Tue Feb 07, 2012 9:07 pm
by sounds
Neon is right on.

If you're thinking about scrolling the graphics on screen, don't. Copying the data around in video memory has several problems:
  1. A screen refresh during the copy will cause flicker
  2. After copying, you then render the new portion - in other words, you end up doing what Neon suggested anyway. You might save memory but you would have more complicated code.
  3. A spin loop that waits for the screen refresh just eats more CPU cycles, slowing down your graphics capabilities