|
FillMode
Using blitter for filling areas:
The blitter offers a crude area-fill option that
works in tandem with the data-copy operation
described above. Fill mode is activated by
BLTCON1's IFE (Inclusive Fill Enable) bit or EFE
(Exclusive Fill Enable) bit prior to turning on the
blitter. After the blitter reads data from memory
and manipulates it according to the miniterm
settings, the specified fill operation is performed
on the data before it is written to destination
memory. Fill operations work IN DESCENDING MODE
ONLY! The figure below illustrates the effect of
each type of fill operation has on data:
After:
Before FCI = 0 FCI = 1
00011000 00011000 11111111
00100100 00111100 11100111
01000010 01111110 11000011
Fill 01000010 01111110 11000011
00100100 00111100 11100111
00011000 00011000 11111111
00011000 00001000 11110111
00100100 00011100 11100011
Exclusive 01000010 00111110 11000001
Fill 01000010 00111110 11000001
00100100 00011100 11100011
00011000 00001000 11110111
In all fills, the blitter evaluates data one bit at
a time, starting at the rightmost edge and moving to
the left. Before the fill begins, however, the
blitter takes note of the FCI bit (2) of the BLTCON1
register. The value of this bit becomes the initial
fill value of the blitter's fill bit. For the sake
of clarity, let's assume FCI starts at zero.
Here's how inclusive fill works: As the blitter
moves left, it changes all zero bits to zero,
because zero is the current value of the fill bit.
When the blitter encounters a 1 bit, it toggles the
fill bit, changing it to a one. Now the blitter
changes the following 0 bits to 1, because that is
the current value of the fill bit. Every time the
blitter encounters a 1 bit in the data, the fill bit
changes value. The figure above illustrates the
difference between fills that start with FCI = 0 or
FCI = 1.
Exclusive fills take one extra step when they
encounter a 1 bot. In addition to toggling the fill
bit, the blitter replaces that 1 bit with the new
fill-bit value.
Both types of fills expect borders to be defined by
a single 1 bit - one bit to tell the blitter that
it's inside an area, and the other to tell it that
it's outside. When the blitter encounters two one
bits in a row, it assumes that there is no space to
be filled since there is no zero bit between pixels.
If the blitter encounters three 1 bits in a row, the
blitter assumes that it has gone in, out, then back
in to an area to be filled. (The fill bit has been
toggled three times.) This happens when the blitter
runs across an odd number of adjacent bits.
To execute a fill operation, simply set up the
blitter registers for a standard copy operation, set
either the IFE or EFE bit, set the FCI bit to the
desired value, set the DESC to put the blitter in
descending mode, then start the blitter by writing
the area size to the BLTSIZE register. By setting
the blitter's source address equal to the
destination address, you can fill an area without
having to copy data from one separate location to
another.
|