Normal quotes
This commit is contained in:
parent
5e10794a24
commit
18011c595a
352 changed files with 6040 additions and 6040 deletions
44
28-04.md
44
28-04.md
|
|
@ -166,55 +166,55 @@
|
|||
code ends
|
||||
end Start
|
||||
|
||||
### When all Planes “Don’t Care” {#Heading5}
|
||||
### When all Planes "Don't Care" {#Heading5}
|
||||
|
||||
Still and all, there aren’t all that many uses for basic color compare
|
||||
Still and all, there aren't all that many uses for basic color compare
|
||||
operations. There is, however, a genuinely odd application of read mode
|
||||
1 that’s worth knowing about; but in order to understand that, we must
|
||||
first look at the “don’t care” aspect of color compare operation.
|
||||
1 that's worth knowing about; but in order to understand that, we must
|
||||
first look at the "don't care" aspect of color compare operation.
|
||||
|
||||
As described earlier, during read mode 1 reads the color stored in the
|
||||
Color Compare register is compared to each of the 8 pixels at a given
|
||||
address in VGA memory. But—and it’s a big but—any plane for which the
|
||||
corresponding bit in the Color Don’t Care register is a 0 is always
|
||||
address in VGA memory. But—and it's a big but—any plane for which the
|
||||
corresponding bit in the Color Don't Care register is a 0 is always
|
||||
considered a color compare match, regardless of the values of that
|
||||
plane’s bits in the pixels and in the Color Compare register.
|
||||
plane's bits in the pixels and in the Color Compare register.
|
||||
|
||||
Let’s look at this another way. A given pixel is controlled by four
|
||||
bits, one in each plane. Normally (when the Color Don’t Care register is
|
||||
Let's look at this another way. A given pixel is controlled by four
|
||||
bits, one in each plane. Normally (when the Color Don't Care register is
|
||||
0FH), the color in the Color Compare register is compared to the four
|
||||
bits of each pixel; bit 0 of the Color Compare register is compared to
|
||||
the plane 0 bit of each pixel, bit 1 of the Color Compare register is
|
||||
compared to the plane 1 bit of each pixel, and so on. That is, when the
|
||||
lower four bits of the Color Don’t Care register are all set to 1, then
|
||||
lower four bits of the Color Don't Care register are all set to 1, then
|
||||
all four bits of a given pixel must match the Color Compare register in
|
||||
order for a read mode 1 read to return a 1 for that pixel to the CPU.
|
||||
|
||||
However, if any bit of the Color Don’t Care register is 0, then the
|
||||
However, if any bit of the Color Don't Care register is 0, then the
|
||||
corresponding bit of each pixel is unconditionally considered to match
|
||||
the corresponding bit of the Color Compare register. You might think of
|
||||
the Color Don’t Care register as selecting exactly which planes should
|
||||
the Color Don't Care register as selecting exactly which planes should
|
||||
matter in a given read mode 1 read. At the extreme, if all bits of the
|
||||
Color Don’t Care register are 0, then read mode 1 reads will always
|
||||
Color Don't Care register are 0, then read mode 1 reads will always
|
||||
return 0FFH, since all planes are considered to match all bits of all
|
||||
pixels.
|
||||
|
||||
Now, we’re all prone to using tools the “right” way—that is, in the way
|
||||
in which they were intended to be used. By that token, the Color Don’t
|
||||
Now, we're all prone to using tools the "right" way—that is, in the way
|
||||
in which they were intended to be used. By that token, the Color Don't
|
||||
Care register is clearly intended to mask one or more planes out of a
|
||||
color comparison, and as such, has limited use. However, the Color Don’t
|
||||
Care register becomes far more interesting in exactly the “extreme” case
|
||||
described above, where all planes become “don’t care” planes.
|
||||
color comparison, and as such, has limited use. However, the Color Don't
|
||||
Care register becomes far more interesting in exactly the "extreme" case
|
||||
described above, where all planes become "don't care" planes.
|
||||
|
||||
Why? Well, as I’ve said, when all planes are “don’t care” planes, read
|
||||
Why? Well, as I've said, when all planes are "don't care" planes, read
|
||||
mode 1 reads always return 0FFH. Now, when you AND any value with 0FFH,
|
||||
the value remains unchanged, and that can be awfully handy when you’re
|
||||
the value remains unchanged, and that can be awfully handy when you're
|
||||
using the bit mask to modify selected pixels in VGA memory. Recall that
|
||||
you must always read VGA memory to load the latches before writing to
|
||||
VGA memory when you’re using the bit mask. Traditionally, two separate
|
||||
VGA memory when you're using the bit mask. Traditionally, two separate
|
||||
instructions—a read followed by a write—are used to perform this task.
|
||||
The code in Listing 28.2 uses this approach. Suppose, however, that
|
||||
you’ve set the VGA to read mode 1, with the Color Don’t Care register
|
||||
you've set the VGA to read mode 1, with the Color Don't Care register
|
||||
set to 0 (meaning all reads of VGA memory will return 0FFH). Under these
|
||||
circumstances, you can use a single **AND** instruction to both read and
|
||||
write VGA memory, since ANDing any value with 0FFH leaves that value
|
||||
|
|
|
|||
Loading…
Reference in a new issue