Commodore 128 Programmer's Reference Manual page 295

Hide thumbs Also See for 128:
Table of Contents

Advertisement

SPRITES
285
(
i
!
I
n
If the bit pair is equal to 00, the pixels are transparent and the background from
the screen passes through the sprite. If the bit pattern equals 10 (binary), the color is
taken from the sprite color register (locations 53287-53294) of the sprite being defined.
Otherwise, the other two bit pair possibilities (01 and 11) are taken from sprite
multi-color registers 0 and 1 respectively.
POSITIONING SPRITES ON THE SCREEN
Each sprite has two position registers to control the sprite's position on the visible screen:
horizontal (X coordinate) and vertical (Y coordinate) positions. Figure 9-7 gives the
memory locations of the sprite position registers as they appear in the C128 memory.
LOCATION
DECIMAL
HEX
DESCRIPTION
53248
53249
53250
53251
53252
53253
53254
53255
53256
53257
53258
53259
53260
53261
53262
53263
53264
($D000)
($D001)
($D002)
($D003)
($D004)
($D005)
($D006)
($D007)
($D008)
($D009)
($D00A)
($D00B)
($D00C)
($D00D)
($D00E)
($D00F)
($D010)
SPRITE 0 X POSITION REGISTER
SPRITE 0 Y POSITION REGISTER
SPRITE 1 X POSITION REGISTER
SPRITE 1 Y POSITION REGISTER
SPRITE 2 X POSITION REGISTER
SPRITE 2 Y POSITION REGISTER
SPRITE 3 X POSITION REGISTER
SPRITE 3 Y POSITION REGISTER
SPRITE 4 X POSITION REGISTER
SPRITE 4 Y POSITION REGISTER
SPRITE 5 X POSITION REGISTER
SPRITE 5 Y POSITION REGISTER
SPRITE 6 X POSITION REGISTER
SPRITE 6 Y POSITION REGISTER
SPRITE 7 X POSITION REGISTER
SPRITE 7 Y POSITION REGISTER
SPRITE X MSB REGISTER
Figure 9-7. Memory Location of Sprite Position Register
The sprite position registers together plot the sprite on a vertical and horizontal
coordinate. The position of reference for the calculated vertical and horizontal coordi
nate is taken from the upper-left corner pixel within the sprite. Whenever you want to
place the sprite on a particular screen position, calculate the position using the upper left
corner pixel within the sprite. The sprite coordinate plane is not the same as the bit-map
coordinate plane. The bit-map coordinate plane starts in the upper-left corner of the
screen at coordinate 0,0. The lower right corner of the bit map coordinate plane is point
319,199. The sprite coordinate plane starts at point 24,50 in the top-left corner of the
visible screen. The final visible point on the sprite coordinate plane at the bottom-right
corner of the screen is 343,249. Figure 9-8 shows how the sprite coordinate plane
relates to the visible screen.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents