Character ROM

From DenialWIKI
Jump to navigation Jump to search

The Character ROM is 4 KB of onboard ROM used to supply character data to the Video Interface Chip (VIC). A register on the VIC allows the character lookup address to be changed, so that custom characters can be used.

The character ROM consists of four 1 KB ROMS:

  • $8000-$83FF: 1 KB uppercase/glyphs
  • $8400-$87FF: 1 KB uppercase/lowercase
  • $8800-$8BFF: 1 KB inverse uppercase/glyphs
  • $8C00-$8FFF: 1 KB inverse uppercase/lowercase

Switching between lowercase and glyphs, or enabling and disabling inverse video, changes the character lookup address.

Character layout

By default, the VIC draws 8x8 pixel characters. One byte is used per row, with the bits specifying that the foreground or background should be used. The onboard character ROM is intended for this default state, and uses eight bytes per character. When drawing the screen, the VIC first looks to the screen RAM, where one byte is used for each character onscreen. The VIC then takes this value, goes to the address (CharacterMemory + Value) * 8, looks up eight bytes, and uses them to draw the character. For each bit, a zero will draw the background color and a one will draw the foreground color.

This can be changed in two ways: First, a register on the VIC can switch to 16-row characters. In this mode, the pixels are the same size but the characters are twice as tall, and sixteen bytes are used for each character. Second, multicolor character mode can be enabled on a per-character basis. In this mode, one byte is still used per row, but instead of eight square pixels with one bit each, there are four wide pixels with two bits per pixels. Both multicolor and double-height characters can be used together.

Sample character

In the video memory, character 0 is the at sign (@), character 1 is capital A, character 2 is capital B, etc. That means capital A is stored in character ROM bytes 8-15, or memory addresses $8008-$800F. When these values are shown in binary, it is obvious how characters are constructed:

Address Byte value Binary
$8008 $18 0 0 0 1 1 0 0 0
$8009 $24 0 0 1 0 0 1 0 0
$800A $42 0 1 0 0 0 0 1 0
$800B $7E 0 1 1 1 1 1 1 0
$800C $42 0 1 0 0 0 0 1 0
$800D $42 0 1 0 0 0 0 1 0
$800E $42 0 1 0 0 0 0 1 0
$800F $00 0 0 0 0 0 0 0 0