
bits) needed to define a sprite. The 63 bytes are arranged in 21 rows of
3 bytes each. A sprite definition looks like this:
BYTE0
BYTE3
BYTE6
BYTE1
BYTE4
BYTE7
BYTE2
BYTE5
BYTE8
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 1 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.
SPRITE
POINTERS
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.
EC'ch 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 last 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).
PROGRAMMING GRAPHICS 133
Komentáře k této Příručce