A virtual screen is a reserved memory area where you draw you graphics in the background. This means that you draw the next screen while displaying the current.
What is this good for? you might ask. Well, mainly because of the fact that you won't have to worry about flickering graphics (, a line is not always completed so it appears for flash.) The user will not be able to see the objects being drawn, but only the result.
How? is the next question. It's quit easy really. The standard 13h VGA mode we are using uses one byte per pixel. This means that a screen will consume 320x200x1=64000 bytes of memory. Instead of changing the bits in the actual video memory we can reserve a 64000 bytes area and make our changes there. Then, when the scene is drawn, we can copy it onto the screen.
This does need some changes in the GFXMAN.CPP file, but I'll try to keep them small.
Plot
All graphic output is made through this function. By adapting it to the new system we can make all graphics reroute to the virtual screen. A minor optimisation will also be applied to improve graphics performance.
SetVGA/SetText
These routines will allocate respectively reallocate the memory used for our virtual screen.
Cls
This function also accesses the video memory directly and has to be rewritten.
ScreenCopy
This function will be added. It will copy the contents of the virtual screen to the video memory.
These are the necesseary changes to be made to GFXMAN.CPP. The new version can be found here.
This file contains changes that will make this version of GFXMAN.CPP incompatible with software written for the old version, it has therefore been named GFXMAN2.CPP.