Commodore 128 Programmer's Reference Manual page 289

Hide thumbs Also See for 128:
Table of Contents

Advertisement

H
I i
SPRITES
279
THE INNER WORKINGS OF SPRITES
i
i
1 \
You have seen how to create, move, color and expand sprites with the BASIC 7.0 sprite
commands. This section explains how to control sprites outside of the BASIC sprite
<—>
commands (except SPRDEF). This tells you which VIC registers are affected and the
|
specific bits that must be set or cleared to manipulate the sprite features.
Registers of the VIC chip control all aspects of sprites. The enabling of specific
bits in certain VIC registers turns on the features of the eight available sprites. The order
| |
in which you turn on these features is critical to sprite animation. Following is a
I ^
summary of the steps necessary to display, color, move and expand sprites. Next to each
step is the VIC chip register or other memory location involved in each element of sprite
p|
programming.
j!
SPRITE PROGRAMMING SEQUENCE
REGISTERS INVOLVED
R
1. Create the sprite image
Sprite Data Storage: 3584-4095 ($0E00-$0FFF)
'
This is also programmable. You must change the sprite
pointer values.
P
2. Point to the sprite data
Sprite Data Pointers: 2040-2047 ($07F8-$07FF), or
i
8184-8191 ($1FF8-$1FFF) when the bit map screen has
been cleared with GRAPHIC 1,1
Pj
3. Enable (turn on) the sprite
53269 ($D015) (bits 7-0, depending on sprite number)
4.
Color the sprite
Standard 53287-53294 ($D027-$D02E)
Multi-color 53276 ($D01C), 53285 ($D025), 53286 ($D026)
i j
5. Position the sprite
5324S-53264 ($D000-$D010)
6.
Expand the sprite
53271 ($D017) (Y direction), 53277 ($D01D) (X direction)
f|
7.
Define sprite display priorities
53275 ($D01B)
' '
8. Define sprite collision priorities 53278 ($D01E), 53279 ($D01F)
I |
These registers control most sprite characteristics. Once you learn these programming
* ^
steps, you will be able to exercise full control over the display and movement of sprites.
p
CREATING THE SPRITE IMAGE
An easy way to create sprites on the C128 is through SPRite DEFinition mode
(SPRDEF). For an explanation of SPRDEF see the SPRDEF entry in the beginning of
H
this chapter. This section assumes your sprite image is already created, and it resides in
! (
the sprite data storage area. Before leaving SPRDEF, remember to press the SHIFT key
and RETURN at the same time; this allows SPRDEF to store the sprite data in the sprite
^
data storage area. Press RETURN a second time to exit SPRDEF.
i
The Commodore 128 has a dedicated portion of memory ranging from decimal
1
address 3584 ($0E00) through 4095 ($0FFF), where sprite data is stored. This portion of

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents