[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

needed to define a sprite. The 63 bytes are arranged in 21 rows of 3 bytes each. A sprite definition looks like this.

                         BYTE 0  BYTE 1  BYTE 2
                         BYTE 3  BYTE 4  BYTE 5
                         BYTE 6  BYTE 7  BYTE 8
                           ..      ..      ..
                           ..      ..      ..
                           ..      ..      ..
                         BYTE 60 BYTE 61 BYTE 62

Another way to view how a sprite is created is to take a look at the sprite definition block on the bit level. It would look something like Figure 3-2.

In a standard (HI-RES) sprite, each bit set to I is displayed in that sprite's foreground color. Each bit set to 0 is transparent and will display whatever data is behind it. This is similar to a standard character.

Multi-color sprites are similar to multi-color characters. Horizontal resolution is traded for extra color resolution. The resolution of the sprite becomes 12 horizontal dots by 21 vertical dots. Each dot in the sprite becomes twice as wide, but the number of colors displayable in the sprite is increased to 4.


Even though each sprite takes only 63 bytes to define, one more byte is needed as a place holder at the end of each sprite. Each sprite, then, takes up 64 bytes. This makes it easy to calculate where in memory your sprite definition is, since 64 bytes is an even number and in binary it's an even power.

Each of the 8 sprites has a byte associated with it called the SPRITE POINTER. The sprite pointers control where each sprite definition is lo- cated in memory. These 8 bytes are always located as the lost 8 bytes of the 1K chunk of screen memory. Normally, on the Commodore 64, this means they begin at location 2040 ($07F8 in HEX). However, if you move the screen, the location of your sprite pointers will also move.

Each sprite pointer can hold a number from 0 to 255. This number points to the definition for that sprite. Since each sprite definition takes 64 bytes, that means that the pointer can "see" anywhere in the 16K block of memory that the VIC-II chip can access (since 256*64=16K).

[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated May 12, 2002.