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

To display a sprite in a given location, You must POKE the X and Y settings for each SPRITE... remembering that every sprite has its own unique X POKE and Y POKE. The X and Y settings for ail 8 sprites are shown here:

POKE THESE VALUES TO SET X-Y SPRITE POSITIONS
 SPRITE0SPRITE1SPRITE2SPRITE3SPRITE4SPRITE5SPRITE6SPRITE7
SET X V,X V+2,X V+4,X V+6,X V+8,X V+10,X V+12,X V+14,X
SET Y V+1,Y V+3,Y V+5,Y V+7,Y V+9,Y V+11,Y V+13,Y V+15,Y
RIGHTXV+16,1 V+16,2 V+16,4 V+16,8 V+16,16V+16,32V+16,64V+16,128

POKEING AN X POSITION: The possible values of X are 0 to 255, counting from left to right. Values 0 to 23 place all or part of the sprite OUT OF THE VIEWING AREA off the left side of the screen... values 24 to 255 place the sprite IN THE VIEWING AREA up to the 255th position (see next paragraph for settings beyond the 255th X position). To place the sprite at one of these positions, just type the X-POSITION POKE for the sprite you're using. For example, to POKE sprite I at the farthest left X position IN THE VIEWING AREA, type: POKE V+2,24.

X VALUES BEYOND THE 255TH POSITION: To get beyond the 255th position across the screen, you need to make a SECOND POKE using the numbers in the "RIGHT X" row of the chart (Figure 3-5). Normally, the horizontal (X) numbering would continue past the 255th position to 256, 257, etc., but because registers only contain 8 bits we must use a "second register" to access the RIGHT SIDE of the screen and start our X numbering over again at 0. So to get beyond X position 255, you must POKE V+16 and a number (depending on the sprite). This gives you 65 additional X positions (renumbered from 0 to 65) in the viewing area on the RIGHT side of the viewing screen. (You can actually POKE the right side X value as high as 255, which takes you off the right edge of the viewing screen.)

POKEING A Y POSITION: The possible values of Y are 0 to 255, counting from top to bottom. Values 0 to 49 place all or part of the sprite OUT OF THE VIEWING AREA off the TOP of the screen. Values 50 to 229 place the sprite IN THE VIEWING AREA. Values 230 to 255 place all or part of the sprite OUT OF THE VIEWING AREA off the BOTTOM of the screen.


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