Virtual scrolling functionality is selected by passing values other than -1 for the VirtualX and VirtualY parameters to the SetVideoMode function. By passing values other than -1 for the X and Y dimentions of the display mode, you will get a virtual mode such that the width of height of the mode is larger than the physically displayed image. Then you can use the SetDisplayStart function to change the display start address and scroll around within the display memory. The value passed to the SetDisplayStart function is a byte address in video memory for 8-bit and higher modes, so to move the display start address to the 10th pixel and 50th line you would use the following code:
if (driver.SetDisplayStart(
modeInfo.BytesPerScanLine *
50 +
10 * bytesPerPixel);
Don’t forget that if you set a virtual display mode, that you must set the drawBuf.Stride value to the bytesPerLine value that was returned by the SetVideoMode function and not the value stored in the GA_modeInfo structure for the mode! Some hardware devices have restrictions on the pitch that can be programmed for display modes, and this is taken into account when the driver initializes a virtual scrolling mode.
Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com