
10: 2D BITBLT ENGINE
2-82
EPSON
S1D13806 SERIES PROGRAMMING NOTES
AND EXAMPLES (X28B-G-003-01)
10.2.13 Read BitBLT
This Read BitBLT increases the speed of transferring data from the display buffer to system mem-
ory. This BitBLT complements the Write BitBLT and is typically used to save a part of the display
buffer to the system memory. Once the Read BitBLT begins, the BitBLT engine remains active until
all the pixels have been read.
The BitBLT engine requires the address to copy from and the size of the area to copy (width
×
height). The BitBLT engine expects to read a certain number of words. For 16 bpp color depths, the
number of words is the same as the number of pixels due to the fact that each pixel is one WORD
wide. The number of WORD reads the BitBLT engine expects is calculated using the following for-
mula.
nWORDS = nPixels
= BitBLT Width
× BitBLT Height
For 8 bpp color depths, the formula must take into consideration that the BitBLT engine accepts
only WORD accesses and each pixel is one BYTE. The BitBLT engine needs to know whether the
first pixel of each line is stored in the low byte or high byte. This is determined by bit 0 of the Desti-
nation Start Address Register 0 (REG[108h]). If the Destination Phase is 1 (bit 0 of the Destination
Start Address Register 0 is set), the first pixel of each line is placed in the high byte of the WORD
and the contents of the low byte is undefined. If the Destination Phase is 0, the first pixel is placed in
the low byte and the second pixel is placed in the high byte. Depending on the Destination Phase and
the BitBLT Width, the last WORD in each line may contain only one pixel. It is always in the low
byte if more than one WORD per line is required. The number of WORD reads the BitBLT engine
expects for 8 bpp color depths is shown in the following formula.
nWORDS = ((BLTWidth + 1 + DestinationPhase)
÷ 2) × BLTHeight
Example 19
Read 100
× 20 pixels at the screen coordinates x = 25, y = 38 and save to system
memory. Assume a display of 640
× 480 at a color depth of 8 bpp.
1. Calculate the source address (upper left corner of the screen BitBLT rectangle), using the for-
mula.
SourceAddress
= (y
× ScreenStride) + (x × BytesPerPixel)
= (38
× 640) + (25 × 1)
= 24345
= 5F19h
where:
BytesPerPixel = 1 for 8 bpp
BytesPerPixel = 2 for 16 bpp
ScreenStride = DisplayWidthInPixels
× BytesPerPixels = 640 for 8 bpp
Program the BitBLT Source Start Address Registers. REG[106h] is set to 00h, REG[105h] is set
to 5Fh, and REG[104h] is set to 19h.