This page reviews Commodore 64 Sprite Registers. Built into the ROM are graphic characters known as “Sprites” from 0-7. Each one is 24 dots in width by 21 dots in height. It obtains its shape from 63 bytes of data in one of the 256 blocks. The memory there utilizes the shape of a sprite using Sprite Data Pointers, located in the last 8 bytes of screen memory in locations 2040-2047 ($7F8 – $7FF).

The Sprite Data Pointer starts with Sprite 0 up to Sprite 7 when pointing to memory that displays it on the screen. The number in the pointer times 64 equals the address of the first byte of the data block in the VIC-II’s memory.

Each Sprite corresponds to bit patterns of the Sprite Shape data consisting of a number between 0-255 (broken data at the binary level of 0’s and 1’s) fitting into a a single byte.

The data to create a Sprite uses binary digits starting at the right to left in powers of two. So each digit has a bit value that is two times greater than the last. The chart looks like this when calculating a single Sprite. The 0’s represent the background character and the 1’s manage the sprite color when it is turned on (switched from a 0 to 1), which are found in locations $D027 – $D02E (53287-53294).

When register $D01C (53276) is enabled, sprites can contain a multicolor value when some of the horizontal resolution is sacrificed. In this area bits of sprite shape data are grouped together in pairs to manage a double-wide dot of the sprite display. Note: The Sprite will now only be 12 dots wide. The information below points to the registers that manage those colros. Each Sprite occupies an area of memory of 3 bytes per line.

00 Background Color Register 0 (transparent)
01 Sprite Multicolor Register 0 (53285, $D025)
10 Sprite Color Registers (53287-94, $D027-E)
11 Sprite Multicolor Register 1 (53286, $D026)

128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0

SpritePad

A convenient Windows tool has been designed and is free that allows you to create your own Sprites that can then be saved as a binary file or PRG file and added to your projects. This tool uses a graphical interface where you can set the colors of both standard and multicolor sprites, save, and even animate them.

I utilize Sprite Pad myself to design my own individual Sprites when I’m not ripping them from games of the 80’s. The tool provides the option to create a binary file to export the sprite data into a file that can later be imported into the Commodore 64’s Sprite shape data area.

Sprite Positions

Commodore 64 Sprite Registers are used to manage many other functions of a Sprite (0-7) as listed below:

$D000-$D00F (53248-53263)
Horizontal and Vertical Positions on the screen alternating in memory locations $D000-$D00F (53248-53263).

$D010 (53264)
Most significant bits of Sprite(s) Horizontal Position. When a sprite moving to the right passes the 256th’s position bits in here must be reset to allow the sprite to continue all the way to the right

Sprite Enable/Expansion

$D015 (53269)
Sprite Enable Registers. This area requires setting the appropriate sprite bit to turn it on so its visible on the screen (bits 0-7).

$D017 (53271)
Sprite Vertical Expansion. Enabling bits here will give the Sprite(s) a double height, which results in two raster scan lines high rather than one. Enabling the bits here work in conjunction with register $D01D below or go solo.

$D019 (53273)
VIC Interrupt Sprite Collision. Setting bit 2 in this register triggers a collison check between 2 Sprites utilizing zan IRQ (Interrupt Request).

$D01B (53275)
Sprite to Foreground Display Priority Register. Allows a sprite to overlap a foreground character on the screen.

$D01C (53276)
Sprite Multicolor Registers. This is used to alter individual bit pairs to turn on multicolor for Sprites 0-7.

$D01D (53277)
Sprite Horizontal Expansion. Enabling bits here will give the Sprite(s) a double width (twice as wide) without impacting the horizontal resolution. Like it’s counterpart, this register can also work vice versa with the Vertical register above at $D017 or remain independent.

Commodore 64 Sprite Registers: Collisions

$D01E-$D01F (53278-53279)
Sprite Collision Registers. This register holds information in its bits indicating which Sprites were involved in a collision from register $D019. A read here will clear the collision in preparation for the next one. This register though is not perfect for Sprite collisions since multiple sprites overlapping could also have collisions, but an inconsistency exists as which collided first. Therefore it is recommended to check the positions of each Sprite for better accuracy of these results.

Register $D01F (53279) points the bits to the appropriate Sprite involved in a foreground collision (ASCII characters) on the screen. Again this is not perfect and it is preferred to create a Sprite to character collision (best done in Assembly language) to perfect this process.

$D022 (53282). Background Color 1.
This register manages the color for the 01 bit pair when setting multicolor graphics, such as for our Sprite(s) example.

$D023 (53283). Background Color 2. This part of the Commodore 64 Sprite registers control the color for the 10 bit pair of multicolor graphics, such as for our Sprite(s) example.

$D025 (53285). Sprite Multicolor Register 0. A bit pair of 01 here is used to set a Sprite color for its graphics.

Sprite Multicolors

$D026 (53286). Sprite Multicolor Register 1. By setting a value here the bit pair of 11 is enabled for multicolor in Sprite(s).

$D027-$D02E (53287-53294). Activating bits here turn on Sprite colors for each Sprite by bits of hi-resolution sprite data, and multicolor sprites utilize the bit pairs here having a value of 10. Each Sprite can have its own color isolated from the others to allow for many colorful Sprites.

Finally feel free to read the Commodore 64 Sprite article that teaches you how to create your own sprites using the Commodore 64 Sprite Registers that you learned about on this page using Basic programming.

Please follow and like us: