|Previous||Table of Contents||Next|
The second thing youll notice is that exquisite shading effects are possible in 360×480 256-color mode; adjacent lines blend together remarkably smoothly, even with the default palette. The VGA allows you to select your 256 colors from a palette of 256K, so you could, if you wished, set up the colors to produce still finer shading albeit with fewer distinctly different colors available. For more on this and related topics, see the coverage of palette reprogramming that begins in the next chapter.
The one thing you may not notice right away is just how much detail is visible on the screen, because the blending of colors tends to obscure the superior resolution of this mode. Each of the four rectangles displayed measures 180 pixels horizontally by 240 vertically. Put another way, each one of those rectangles has two-thirds as many pixels as the entire mode 13H screen; in all, 360×480 256-color mode has 2.7 times as many pixels as mode 13H! As mentioned above, the resolution is unevenly distributed, with vertical resolution matching that of mode 12H but horizontal resolution barely exceeding that of mode 13Hbut resolution is hot stuff, no matter how its laid out, and 360×480 256-color mode has the highest 256-color resolution youre ever likely to see on a standard VGA. (SuperVGAs are quite another matterbut when you require a SuperVGA youre automatically excluding what might be a significant chunk of the market for your code.)
Now that weve seen the wonders of which our new mode is capable, lets take the time to understand how it works.
In describing 360×480 256-color mode, Im going to assume that youre familiar with the discussion of 320×400 256-color mode in the last chapter. If not, go back to that chapter and read it; the two modes have a great deal in common, and Im not going to bore you by repeating myself when the goods are just a few page flips (the paper kind) away.
360×480 256-color mode is essentially 320×400 256-color mode, but stretched in both dimensions. Lets look at the vertical stretching first, since thats the simpler of the two.
Theres nothing unusual about 480 scan lines; standard modes 11H and 12H support that vertical resolution. The number of scan lines has nothing to do with either the number of colors or the horizontal resolution, so converting 320×400 256mode to 320×480 256-color mode is a simple matter of reprogramming the VGAs vertical control registerswhich control the scan lines displayed, the vertical sync pulse, vertical blanking, and the total number of scan linesto the 480-scansettings, and setting the polarities of the horizontal and vertical sync pulses to tell the monitor to adjust to a 480-line screen.
Switching to 480 scan lines has the effect of slowing the screen refresh rate. The VGA always displays at 70 Hz except in 480-scan-line modes; there, due to the time required to scan the extra lines, the refresh rate slows to 60 Hz. (VGA monitors always scan at the same rate horizontally; that is, the distance across the screen covered by the electron beam in a given period of time is the same in all modes. Consequently, adding extra lines per frame requires extra time.) 60 Hz isnt badthats the only refresh rate the EGA ever supported, and the EGA was the industry standard in its timebut it does tend to flicker a little more and so is a little harder on the eyes than 70 Hz.
Converting from 320 to 360 pixels per scan line is more difficult than converting from 400 to 480 scan lines per screen. None of the VGAs graphics modes supports 360 pixels across the screen, or anything like it; the standard choices are 320 and 640 pixels across. However, the VGA does support the horizontal resolution we seek360 pixelsin 40-column text mode.
Unfortunately, the register settings that select those horizontal resolutions arent directly transferable to graphics mode. Text modes display 9 dots (the width of one character) for each time information is fetched from display memory, while graphics modes display just 4 or 8 dots per display memory fetch. (Although its a bit confusing, its standard terminology to refer to the interval required for one display memory fetch as a character, and Ill follow that terminology from now on.) Consequently, both modes display either 40 or 80 characters per scan line; the only difference is that text modes display more pixels per character. Given that graphics modes cant display 9 dots per character (theres only enough information for eight 16pixels or four 256-color pixels in each memory fetch, and thats that), wed seem to be at an impasse.
|Previous||Table of Contents||Next|