C64 Images

The Commodore 64 draws full-screen pictures in the VIC-II's bitmap modes. Standard hi-res gives 320×200 pixels with two colours per 8×8 cell, and multicolour gives 160×200 with four colours per cell at half the horizontal resolution. Both share a 15-colour palette and a colour-per-cell scheme like other 8-bit machines of the day.

C64 Images

Overview

The VIC-II reaches bitmap mode when bit 5 of the control register $D011 is set. The screen then becomes a grid of 8×8 cells whose pixels come from an 8000-byte bitmap, while colour is applied per cell rather than per pixel. Two bitmap modes exist: standard hi-res and multicolour, chosen by bit 4 of $D016. Both fill the same visible area of 40×25 cells.

PropertyValue
Cells40 × 25, each 8 × 8 pixels
Bitmap size8000 bytes
Palette16 fixed colours
Hi-res320 × 200, 2 colours per cell
Multicolour160 × 200, 4 colours per cell

Bitmap modes

The two bitmap modes differ in how the bits of the 8000-byte bitmap are read and where each cell's colours come from. Hi-res reads one bit per pixel and gives two colours per cell; multicolour reads two bits per pixel and gives four colours per cell, trading half the horizontal resolution for the extra colours.

ModeResolutionBits/pixelColours per cellSelected by
Standard hi-res320 × 20012$D011 bit 5 set, $D016 bit 4 clear
Multicolour160 × 20024$D011 bit 5 set, $D016 bit 4 set

Standard hi-res bitmap

In hi-res the bitmap is 8000 bytes, one bit per pixel, the most significant bit on the left. The 320×200 image is stored cell by cell: the eight bytes of one 8×8 cell are consecutive, then the next cell to the right, in the same interleaved order the VIC-II uses for character rows.

Colour comes from the video matrix, the same 1000-byte area that holds character codes in text mode. Each cell's byte is split into two nibbles: the high nibble is the colour of set (1) pixels, the low nibble the colour of clear (0) pixels. So each cell shows exactly two of the 16 colours, chosen independently per cell.

Pixel bitColour source
1High nibble of the cell's video-matrix byte
0Low nibble of the cell's video-matrix byte

Multicolour bitmap

In multicolour the bitmap is read two bits at a time, so each cell is 4 pixels wide by 8 tall, each pixel two screen pixels across. This halves horizontal resolution to 160 but gives four colours per cell. Each pixel's bit pair selects one of four sources: a screen-wide background, the two nibbles of the video-matrix byte, and the cell's Colour RAM nibble.

Bit pairColour source
00Background colour, register $D021
01High nibble of the cell's video-matrix byte
10Low nibble of the cell's video-matrix byte
11Colour RAM nibble for that cell, $D800–$DBFF

Three of the four colours are chosen per cell, and the fourth (bit pair 00) is shared across the whole screen. Colour RAM is 1000 nibbles at $D800, one per cell, and only its low four bits are used.

Bank and base registers

The VIC-II can only see 16K at a time. The two low bits of the CIA 2 port at $DD00 select which of the four 16K banks the chip reads, so the bitmap, video matrix and colour data must all live in the chosen bank. These bits are inverted: value 0 selects the top bank.

Within the bank, the memory-control register $D018 places the bitmap and the video matrix. In bitmap mode bit 3 of $D018 chooses the bitmap base as the low or high 8K half of the bank, and the top four bits choose the video matrix in 1K steps.

RegisterBitsMeaning
$DD000–1VIC bank select (inverted): 0 = $C000, 3 = $0000.
$D0183Bitmap base within bank: 0 = low 8K, 1 = high 8K.
$D0184–7Video matrix base within bank, in 1K steps.
$D0210–3Background colour, used by multicolour bit pair 00.
$D800–$DBFFColour RAM, one nibble per cell.