MOS 6560/6561 VIC-I Video Interface Circuit documentation This document is Copyright © 1995-1998 Marko Mäkelä . This document may be reproduced in whole, provided that everything, including this copyright message, is included. Any updated versions of this file will be available from . Revision history: Revision 1.0: Initial revision (December 1996). Revision 1.1: Corrected the screen size information (July 1997). The 1084 monitor I used did not display all lines. There are only 9 blank lines. Thanks to Timo Raita for pointing this out and for lending his equipment. The horizontal resolutions were calculated wrong. Revision 1.2: Updated the sound frequency formulas (February 1998). Levente Hársfalvi made some experiments with the frequencies and provided me with revised formulas. The 6560 pinout and most of the register map were quoted from the Commodore VIC-20 Programmer's Reference Guide, and the register map and other parts of this document were enhanced with the results got by measuring the 6560-101 and 6561-101 chips. Thanks to Miguel Gordillo for his help in measuring the NTSC-M screen size. Comparison of the known VIC-20 video chips (summary) Chip 6560-101 6561-101 System NTSC-M PAL-B Cycles/line 65 71 Lines/frame 261 312 - interlaced 525 - Crystal 14318181 Hz 4433618 Hz Bus clock crystal/14 crystal/4 Screen width 201 229 Screen height 252 303 - interlaced 253,5 - 6560 pinout (according to the Programmer's Reference Guide): 1 nc 2 comp colour 3 sync&lumin 4 r/w 5-16 db11-db0 17 dotx 18 dot y 19 comp snd 20 vss 21-34 a0-a13 35 pPhi1 36 pPhi2 37 option 38 Phi2 in 39 Phi1 in 40 Vdd 9000 ABBBBBBB 9001 CCCCCCCC 9002 HDDDDDDD 9003 GEEEEEEF 9004 GGGGGGGG 9005 HHHHIIII 9006 JJJJJJJJ 9007 KKKKKKKK 9008 LLLLLLLL 9009 MMMMMMMM 900A NRRRRRRR 900B OSSSSSSS 900C PTTTTTTT 900D QUUUUUUU 900E WWWWVVVV 900F XXXXYZZZ A: interlace mode (6560-101 only): 0=off, 1=on In this mode, the videochip will draw 525 interlaced lines of 65 cycles per line, instead of the 261 non-interlaced lines in the normal mode. This bit has no effect on the 6561-101. B: screen origin X (4 pixels granularity) 6560-101: at 22 chars/line, the suitable range is 1 to 8 With 22 chars/line, the value 8 will show only 5 pixels of the rightmost column 6561-101: at 22 chars/line, the suitable range is 5 to 19 With 22 chars/line, the value 20 will show only 5 pixels of the rightmost column Both: If the value B+2*D is greater than CYCLES_PER_LINE-4, the picture will mix up. With the value 0, there is some disturbance on the screen bottom. C: screen origin Y (2 lines granularity) 6560-101: suitable range is 5 to 130=(261-1)/2, which will display one raster line of text. 6561-101: suitable range is 5 to 155=312/2-1 Both: No wraparound. The bottom-most line on the screen is 0. D: number of video columns 6560 range: 0-26 makes sense, >31 will be interpreted as 31. 6561-101: 0-29 makes sense, >32 will be interpreted as 32. E: number of video rows (0-63) 6560-101 practical range: 0-29; at C=5, >=32 gives 31 3/8 6561-101 practical range: 0-35; at C=5, >=38 gives 37¾ F: character size (1=8x16, 0=8x8) G: current raster line ($9004=raster counter b8-b1, $9003 bit 7 = b0) Vertical blank is on lines 0 through 27. H: screen memory location ($9005:7-4 = b13-b10, $9002:7 = b9 of screen and colour memory) I: character memory location (b13-b10) * Note that b13 is connected to the inverse of A15 on the Vic-20. J: light pen X K: light pen Y L: paddle X M: paddle Y N: bass enable, R: freq f=Phi2/256/(128-(($900a+1)&127)) O: alto enable, S: freq f=Phi2/128/(128-(($900b+1)&127)) P: soprano enable, T: freq f=Phi2/64/(128-(($900c+1)&127)) Q: noise enable, U: freq f=Phi2/32/(128-(($900d+1)&127)) * PAL: Phi2=4433618/4 Hz * NTSC: Phi2=14318181/14 Hz W: auxiliary colour V: volume control X: screen colour Y: reverse mode Z: border colour multicolour (character colour b7=1) 00 = screen colour 01 = character colour 10 = border colour 11 = auxiliary colour Colour codes: 0 black 1 white 2 red 3 cyan 4 purple 5 green 6 blue 7 yellow 8 orange 9 light orange a pink b light cyan c light purple d light green e light blue f light yellow Video timing As the dot clock on the VIC-I is only 4 times the bus clock, the video chip has time to read 2 bytes for every 8 pixels it outputs. All memory accesses are performed without blocking the processor, using the interleaved bus. The basic video timing is very simple. For every character the VIC-I is about to display, it first fetches the character code and colour, then the character appearance (from the character generator memory). The character codes are read on every raster line, thus making every line a "bad line". When the raster beam is outside of the text window, the videochip reads from $001c for most time. (Some videochips read from $181c instead.) The address occasionally varies, but it might also be due to a flaky bus. (By reading from unconnected address space, such as $9100-$910f, you can read the data fetched by the videochip on the previous clock cycle.)