
Page 88
Epson Research and Development
Vancouver Design Center
S1D13A05
Programming Notes and Examples
X40A-G-003-04
Issue Date: 2002/08/21
The number of WORD accesses is dependant on the position of the first pixel within the
first WORD of each row. Is the pixel stored in the low byte or the high byte of the WORD?
This aspect of the BitBLT is called phase and is determined as follows:
Source phase is 0 when the first pixel is in the low byte and the second pixel is in the high
byte of the WORD. When the source phase is 0, bit 0 of the Source Start Address Register
is 0. The Source Phase is 1 if the first pixel of each row is contained in the high byte of the
WORD, the contents of the low byte are ignored. When the source phase is 1, bit 0 of the
Source Start Address Register is set.
Depending on the Source Phase and the BitBLT Width, the last WORD may contain only
one pixel. In this case it is always in the low byte. The number of WORD writes the BitBLT
engine expects for 8 bpp color depths is shown in the following formula.
WORDS
= ((BitBLTWidth + 1 + SourcePhase)
÷ 2) × BitBLTHeight
Once the Transparent Write BitBLT begins, the BitBLT engine remains active until all
pixels have been written. The BitBLT engine requires the correct number of WORDS to be
sent from the local CPU before it ends the Transparent Write BitBLT operation.
Note
The BitBLT engine counts WORD writes made to the BitBLT register. This does not
imply only 16-bit CPU instructions are acceptable. If a system is able to separate one
DWORD write into two WORD writes and the CPU writes the low word before the
high word, then 32-bit CPU instructions are acceptable. Otherwise, 16-bit CPU instruc-
tions are required.
Example 14: Write 100 x 20 pixels at the screen coordinates x = 25, y = 38 using a
320x240 display at a color depth of 8 bpp. Transparent color is high in-
tensity blue (assume LUT Index 124).
1. Calculate the destination address (upper left corner of the screen BitBLT rectangle),
using the formula:
DestinationAddress = (y
× ScreenStride) + (x × BytesPerPixel)
= (38
× 320) + (25 × 1)
= 12185
= 2F99h
where:
BytesPerPixel = 1 for 8 bpp
ScreenStride = DisplayWidthInPixels
× BytesPerPixel = 320 for 8 bpp
Program the BitBLT Destination Start Address Register. REG[8010h] is set to 2F99h.
2. Program the BitBLT Width Register to 100 - 1. REG[8018h] is set to 63h (99 deci-
mal).
3. Program the BitBLT Height Register to 20 - 1. REG[801Ch] is set to 13h (19 deci-
mal).
4. Program the Source Phase in the BitBLT Source Start Address Register. In this exam-
ple, the data is WORD aligned, so the source phase is 0. REG[800Ch] is set to 00h.