In line 11 this time, another sprite (4) was made to appear by POKE-
ing 28 into the appropriate "on" location of the sprite memory section.
Now sprites 2-4 are on (00011100
= 28).
Line 12 indicates that sprite 4 will get its data from the same
memory area (13th 63 section area) as the other sprites by POKEing
2044,13.
In line 25, sprites 2 and 3 are expanded by POKEing 12 (Sprites 2
and 3 on) into the X and Y direction expanded memory locations (V+23
and V+29).
Line 48 moves sprite 3 along the X axis. Line 58 positions sprite 3
halfway down the screen, at location 100. Because this value does not
change, like it did before with X=O to 200, sprite 3 just moves horizon-
tally.
ADDITIONAL NOTES ON SPRITES
Now that you've experimented with sprites, a few more words are in
order. First, you can change a sprite's color to any of the standard 16
color codes (0-15) that were used to change character color. These can
be found in Chapter 5 or in appendix G.
For example, to change sprite 1 to light green, type: POKE
V+40,13 (be sure to set V=53248).
You may have no~iced in using the example sprite programs that
the object never moved to the right-hand edge of the screen. This was
because the screen is 320 dots wide and the X direction register can
only hold a value up to 255. How then can you get an object to move
across the entire screen?
There is a location on the memory map that has not been men-
tioned yet. Location 16 (of the map) controls something called the most
significant bit (MSB) of the sprite's X direction location. In effect, this
allows you to move the sprite to a horizontal spot between 256 and 320.
The MSB of X register works like this: after the sprite has been
moved to X location 255, place a value into memory location 16 repre-
senting the sprite you want to move. For example, to get 2 to move to
horizontal locations 256-320, POKEthe value for sprite 2 which is (4) into
memory location 16:
POKE V+16,4.
Now start from 0 again in the usual X direction register for sprite 2
(which is in location 4 of the map). Since you are only moving another 64
spaces, X locations would only range between 0 and 63 this time.
75