Normal quotes

This commit is contained in:
James Gregory 2013-12-30 18:34:31 +11:00
commit 18011c595a
352 changed files with 6040 additions and 6040 deletions

View file

@ -17,53 +17,53 @@ are by no means a standard, and differences between seemingly identical
modes from different manufacturers can be vexing.) More colors can often
compensate for less resolution, but the resolution difference between
the 640x480 16-color mode and the 320x200 256-color mode is so great
that many programmers must regretfully decide that they simply can’t
that many programmers must regretfully decide that they simply can't
afford to use the 256-color mode.
If there’s one thing we’ve learned about the VGA, however, it’s that
there’s *never* just one way to do things. With the VGA, alternatives
always exist for the clever programmer, and that’s more true than you
If there's one thing we've learned about the VGA, however, it's that
there's *never* just one way to do things. With the VGA, alternatives
always exist for the clever programmer, and that's more true than you
might imagine with 256-color mode. Not only is there a high 256-color
resolution, there are *lots* of higher 256-color resolutions, going all
the way up to 360x480—and that’s with the vanilla IBM VGA!
the way up to 360x480—and that's with the vanilla IBM VGA!
In this chapter, I’m going to focus on one of my favorite 256-color
In this chapter, I'm going to focus on one of my favorite 256-color
modes, which provides 320x400 resolution and two graphics pages and can
be set up with very little reof the VGA. In the next chapter, I’ll
be set up with very little reof the VGA. In the next chapter, I'll
discuss higher-resolution 256-color modes, and starting in Chapter 47,
I’ll cover the high-performance “Mode X” 256-color programming that many
I'll cover the high-performance "Mode X" 256-color programming that many
games use.
So. Let’s get started.
So. Let's get started.
### Why 320x200? Only IBM Knows for Sure {#Heading3}
The first question, of course, is, “How can it be possible to get higher
256-color resolutions out of the VGA?” After all, there were no unused
The first question, of course, is, "How can it be possible to get higher
256-color resolutions out of the VGA?" After all, there were no unused
higher resolutions to be found in the CGA, Hercules card, or EGA.
The answer is another question: “Why did IBM *not* use the
higher-resolution 256-color modes of the VGA?” The VGA is easily capable
The answer is another question: "Why did IBM *not* use the
higher-resolution 256-color modes of the VGA?" The VGA is easily capable
of twice the 200-scan-line vertical resolution of mode 13H, the
256-color mode, and IBM clearly made a decision not to support a
higher-resolution 256-color mode. In fact, mode 13H *does* display 400
scan lines, but each row of pixels is displayed on two successive scan
lines, resulting in an effective resolution of 320x200. This is the same
scan-doubling approach used by the VGA to convert the CGA’s
scan-doubling approach used by the VGA to convert the CGA's
200-scan-line modes to 400 scan lines; however, the resolution of the
CGA has long been fixed at 200 scan lines, so IBM had no choice with the
CGA modes but to scan-double the lines. Mode 13H has no such historical
limitation—it’s the first 256-color mode ever offered by IBM, if you
don’t count the late and unlamented Professional Graphics Controller
limitation—it's the first 256-color mode ever offered by IBM, if you
don't count the late and unlamented Professional Graphics Controller
(PGC). Why, then, would IBM choose to limit the resolution of mode 13H?
There’s no way to know, but one good guess is that IBM wanted a standard
There's no way to know, but one good guess is that IBM wanted a standard
256-color mode across all PS/2 computers (for which the VGA was
originally created), and mode 13H is the highest-resolution 256-color
mode that could fill the bill. You see, each 256-color pixel requires
one byte of display memory, so a 320x200 256-color mode requires 64,000
bytes of display memory. That’s no problem for the VGA, which has 256K
of display memory, but it’s a stretch for the MCGA of the Model 30,
bytes of display memory. That's no problem for the VGA, which has 256K
of display memory, but it's a stretch for the MCGA of the Model 30,
since the MCGA comes with only 64K.
On the other hand, the smaller display memory size of the MCGA also
@ -71,9 +71,9 @@ limits the number of colors supported in 640x480 mode to 2, rather than
the 16 supported by the VGA. In this case, though, IBM simply created
two modes and made both available on the VGA: mode 11H for 640x480
2-color graphics and mode 12H for 640x480 16-color graphics. The same
could have been done for 256-color graphics—but wasn’t. Why? I don’t
know. Maybe IBM just didn’t like the odd aspect ratio of a 320x400
graphics mode. Maybe they didn’t want to have to worry about how to map
could have been done for 256-color graphics—but wasn't. Why? I don't
know. Maybe IBM just didn't like the odd aspect ratio of a 320x400
graphics mode. Maybe they didn't want to have to worry about how to map
in more than 64K of display memory. Heck, maybe they made a mistake in
designing the chip. Whatever the reason, mode 13H is really a
400-scan-line mode masquerading as a 200-scan-line mode, and we can
@ -81,12 +81,12 @@ readily end that masquerade.
### 320x400 256-Color Mode {#Heading4}
Okay, what’s so great about 320x400 256-color mode? Two things: easy,
Okay, what's so great about 320x400 256-color mode? Two things: easy,
safe mode sets and page flipping.
As I said above, mode 13H is really a 320x400 mode, albeit with each
line doubled to produce an effective resolution of 320x200. That means
that we don’t need to change any display timings, widths, or heights in
that we don't need to change any display timings, widths, or heights in
order to tweak mode 13H into 320x400 mode—and that makes 320x400 a safe
choice. Basically, 320x400 mode differs from mode 13H only in the
settings of *mode* bits, which are sure to be consistent from one VGA
@ -105,19 +105,19 @@ supported. Each 320x400 256-color mode requires 128,000 bytes of display
memory, so we can just barely manage two pages in 320x400 mode, one
starting at offset 0 in display memory and the other starting at offset
8000H. Those two pages are the largest pair of pages that can fit in the
VGA’s 256K, though, and the higher-resolution 256-color modes, which use
VGA's 256K, though, and the higher-resolution 256-color modes, which use
still larger bitmaps (areas of display memory that control pixels on the
screen), can’t support two pages at all. As we’ve seen in earlier
screen), can't support two pages at all. As we've seen in earlier
chapters and will see again in this book, paging is very useful for
off-screen construction of images and fast, smooth animation.
That’s why I like 320x400 256-color mode. The next step is to understand
how display memory is organized in 320x400 mode, and that’s not so
That's why I like 320x400 256-color mode. The next step is to understand
how display memory is organized in 320x400 mode, and that's not so
simple.
#### Display Memory Organization in 320x400 Mode {#Heading5}
First, let’s look at why display memory must be organized differently in
First, let's look at why display memory must be organized differently in
320x400 256-color mode than in mode 13H. The designers of the VGA
intentionally limited the maximum size of the bitmap in mode 13H to 64K,
thereby limiting resolution to 320x200. This was accomplished *in