
10: 2D BITBLT ENGINE
2-68
EPSON
S1D13806 SERIES PROGRAMMING NOTES
AND EXAMPLES (X28B-G-003-01)
Example 12
Copy a 9
× 321 rectangle at the screen coordinates x = 100, y = 10 to screen coordi-
nates x = 200, y = 20 using a 640
× 480 display at a color depth of 16 bpp.
1. Calculate the source and destination addresses (upper left corners of the source and destination
rectangles), using the following formula.
SourceAddress
= (y
× ScreenStride) + (x × BytesPerPixel)
= (10
× (640 × 2)) + (100 × 2)
= 13000
= 32C8h
DestinationAddress = (y
× ScreenStride) + (x × BytesPerPixel)
= (20
× (640 × 2)) + (200 × 2)
= 26000
= 6590h
where:
BytesPerPixel = 1 for 8 bpp
BytesPerPixel = 2 for 16 bpp
ScreenStride = DisplayWidthInPixels
× BytesPerPixel = 1280 for 16 bpp
Program the BitBLT Source Start Address Registers. REG[106h] is set to 00h, REG[105h] is set
to 32h, and REG[104h] is set to C8h.
Program the BitBLT Destination Start Address Registers. REG[10Ah] is set to 00h, REG[109h]
is set to 65h, and REG[108h] is set to 90h.
2. Program the BitBLT Width Registers to 9 - 1. REG[111h] is set to 00h and REG[110h] is set to
08h.
3. Program the BitBLT Height Registers to 321 - 1. REG[113h] is set to 01h and REG[112h] is set
to 40h (320 decimal).
4. Program the BitBLT Operation Register to select the Move BitBLT in Positive Direction with
ROP. REG[103h] is set to 02h.
5. Program the BitBLT ROP Code Register to select Destination = Source. REG[102h] is set to
0Ch.
6. Program the BitBLT Color Format Select bit for 16 bpp operations. REG[101h] is set to 01h.
7. Program the BitBLT Memory Offset Registers to the ScreenStride in WORDS.
BltMemoryOffset
= ScreenStride
÷ 2
= 640
= 280h
REG[10Dh] is set to 02h and REG[10Ch] is set to 80h.
8. Program the BitBLT Destination/Source Linear Select bits for a rectangular BitBLT (BitBLT
Destination Linear Select = 0, BitBLT Source Linear Select = 0).
Start the BitBLT operation. REG[100h] is set to 80h.
9. Once the BitBLT operation is finished, read one word from offset 0 in the BitBLT memory area
to shutdown the BitBLT engine.
Note: The order of register initialization is irrelevant as long as all relevant registers are programmed before
the BitBLT is initiated.