Philips S1D13505 Manuale Utente

Pagina di 556
Epson Research and Development
Page 49
Vancouver Design Center
Programming Notes and Examples
S1D13505
Issue Date: 01/02/05 
X23A-G-003-07
Note
Drawing into the Hardware Cursor/Ink Layer with SwivelView enabled does not work 
without some form of address manipulation. The easiest way to ensure correct cur-
sor/ink images is to disable SwivelView, draw in the cursor/ink memory, then re-enable 
SwivelView. While writing the cursor/ink memory each pixel must be transformed to its 
rotated position.
8.5  Examples
Example 7: Enable SwivelView for a 640x480 display at a color depth of 8 bpp.
Before enabling SwivelView, the display buffer should be cleared to make the transition 
smoother. Currently displayed images cannot simply be rotated by hardware.
1. Set the line offset to 1024 pixels. The Line Offset register is the offset in words.
Write 200h to registers [17h]:[16h]. That is write 02h to register [17h] and 00h to reg-
ister [16h].
2. Set the Display 1 Start Address. The Display Start Address registers form a pointer to 
a word, therefore the value to set the start.
Write C0h (192 or (1024 - 480)/2) to registers [10h], [11h] and [12h]. That is write 
Ch) to register [10h], 00h to register [11h] and 00h to register [12h].
3. Enable SwivelView by setting bit 7 of register [0Dh].
4. The display is now configured for SwivelView. Offset zero into display memory will 
correspond to the upper left corner of the display. The only difference seen by the pro-
grammer will be in acknowledging that the display offset is now 1024 pixels regard-
less of the physical dimensions of the display surface.
Example 8: Pan the above SwivelView image to the right by 3 pixels then scroll it up 
by 4 pixels.
1. With SwivelView enabled, the x and y control is rotated as well. Simply swap the x 
and y co-ordinates and calculate as if the display were not rotated.
2. Calculate the new start address and pixel pan values.
BytesPerScanline = 1024
PixelPan = newX & 01h;
StartAddr = (newY * BytesPerScanline / 2) + (newX & FFFEh) >> 1;
3. Write the start address during the display enabled portion of the frame.
a) loop waiting for vertical non-display (b7 of register [0Ah] high).
    do register = ReadRegister(0Ah)
        while (80h != (register & 80h));