Page 30 Epson Research and Development
Vancouver Design Center
S1D13705 Programming Notes and Examples
X27A-G-002-03 Issue Date: 02/01/22
Example 4:Scrolling (Up and Down)
To scroll down, increase the value in the Screen 1 Display Start Address Register by the
number of words in one virtual scan line. To scroll up, decrease the value in the Screen 1
Display Start Address Register by the number of words in one virtual scan line. A virtual
scan line includes both the number of bytes required by the ph ysi cal display and any extra
bytes that may be being used for creating a virtual width on the display.
The previous dimensions are still in effect for this example (i.e. 320w x 240h virtual size,
256h x 64w physical size at 4 bpp)
Step 1: Determine the number of words in one virtual scanline.
bytes_per_line = pixels_per_line / pixels_per_byte = 320 / 2 = 160
words_per_line = bytes_per_line / 2 = 160 /2 = 80
Step 2: Scroll up or down
To scroll up.
StartWord = GetStartAddress();
StartWord -= words_per_line;
if (StartWord < 0)
StartWord = 0;
SetStartAddress(StartWord);
To scroll down.
StartWord = GetStartAddress();
StartWord += words_per_line;
SetStartAddress(StartWord);
}