The MOS 6567/6569 video controller (VIC-II)
and its application in the Commodore 64
Contents
3. Description of the VIC
3.4. Display generation and display window dimensions
deutsch previous section next section

As usual for controlling CRTs, the VIC builds the video frame line by line. The line number and the number of clock cycles per line are constant for every VIC type. The VIC works character-based, every character consists of a matrix of 8×8 pixels, so a text line is made up of 8 pixel lines. 40×25 text characters are displayed in the text based modes, 320×200 or 160×200 pixels in the bitmap modes.

In this article, the specification of a position on the screen is done with the raster line number as the Y coordinate (RASTER, register $d011/$d012) and a X coordinate that corresponds to the sprite coordinate system. When specifying the time of a VIC memory access or an internal operation in the VIC, the raster line number is used as Y coordinate and the number of the clock cycle within the line as X coordinate. As previously mentioned, 8 pixels make a clock cycle, so the specification of a sprite X coordinate is eight times more precise than that of a cycle number.

The graphics are displayed in an unmovable window in the middle of the visible screen area, the "display window". The area outside the display window is covered by the screen border and is displayed in the border color (EC, register $d020). You can also turn off the border partially or completely with some little tweaking; then you see that the display window is part of a "display column" that is made up by the linear extension of the display window to the top and bottom. With that you can divide the border in an upper/lower border and a left/right border. The visible screen area is surrounded by blanking intervals in which the video signal is turned off and in which the raster beam returns to the start of the next line or the start of the frame, respectively.

The following figure (not in scale) illustrates the last paragraph:

The height and width of the display window can each be set to two different values with the bits RSEL and CSEL in the registers $d011 and $d016:

RSEL Display window height First line Last line
0 24 text lines/192 pixels 55 ($37) 246 ($f6)
1 25 text lines/200 pixels 51 ($33) 250 ($fa)

CSEL Display window width First X coo. Last X coo.
0 38 characters/304 pixels 31 ($1f) 334 ($14e)
1 40 characters/320 pixels 24 ($18) 343 ($157)

If RSEL=0 the upper and lower border are each extended by 4 pixels into the display window, if CSEL=0 the left border is extended by 7 pixels and the right one by 9 pixels. The position of the display window and its resolution do not change, RSEL/CSEL only switch the starting and ending position of the border display. The size of the video matrix also stays constantly at 40×25 characters.

With XSCROLL/YSCROLL (bits 0-2 of registers $d011 (XSCROLL) and $d016 (YSCROLL)), the position of the graphics inside the display window can be scrolled in single-pixel units up to 7 pixels to the right and to the bottom. This can be used for soft scrolling. The position of the display window itself doesn't change. To keep the graphics aligned with the window, X/YSCROLL have to be 0 and 3 for 25 lines/40 columns and both 7 for 24 lines/38 columns.

The dimensions of the video display for the different VIC types are as follows:

Type Video
system
#of
lines
Visible
lines
Cycles/
line
Visible
pixels/line
6567R56A NTSC-M 262 234 64 411
6567R8 NTSC-M 263 235 65 418
6569 PAL-B 312 284 63 403

Type First
vblank
line
Last
vblank
line
First X coo.
of a line
First
visible
X coo.
Last
visible
X coo.
6567R56A 13 40 412 ($19c) 488 ($1e8) 388 ($184)
6567R8 13 40 412 ($19c) 489 ($1e9) 396 ($18c)
6569 300 15 404 ($194) 480 ($1e0) 380 ($17c)

If you are wondering why the first visible X coordinates seem to come after the last visible ones: This is because for the reference point to mark the beginning of a raster line, the occurrence of the raster IRQ has been chosen, which doesn't coincide with X coordinate 0 but with the coordinate given as "First X coo. of a line". The X coordinates run up to $1ff (only $1f7 on the 6569) within a line, then comes X coordinate 0. This is explained in more detail in the explanation of the structure of a raster line.