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

There are 200 different dot positions that can be individually pro- grammed onto your TV screen in the Y direction. The sprite Y position registers can handle numbers up to 255. This means that you have more than enough register locations to handle moving a sprite up and down. You also want to be able to smoothly move a sprite on and off the screen. More than 200 values are needed for this.

The first on-screen value from the top of the screen, and in the Y direction for an unexpanded sprite is 30. For a sprite expanded in the Y direction it would be 9. (Since each dot is twice as tall, this makes a certain amount of sense, as the initial position is STILL calculated from the top left corner of the sprite.)

The first Y value in which a sprite (expanded or not) is fully on the screen (all 21 possible lines displayed) is 50.

The last Y value in which an unexpanded sprite is fully on the screen is 229. The last Y value in which an expanded sprite is fully on the screen is 208.

The first Y value in which a sprite is fully off the screen is 250.

EXAMPLE:

 10 PRINT"{CLEAR}"                :REM CLEAR SCREEN
 20 POKE 2040,13                  :REM GET SPRITE 0 DATA FROM BLOCK 13
 30 FORI=0TO62:POKE832+I,129:NEXT :REM POKE SPRITE DATA INTO BLOCK 13
 40 V=53248                       :REM SET BEGINNING OF VIDEO CHIP
 50 POKEV+21,1                    :REM ENABLE SPRITE 0
 60 POKEV+39,1                    :REM SET SPRITE 0 COLOR
 70 POKEV+1,100                   :REM SET SPRITE 0 Y POSITION
 80 POKEV+16,0:POKEV,100          :REM SET SPRITE 0 X POSITION

HORIZONTAL POSITIONING

Positioning in the horizontal direction is more complicated because there are more than, 256 positions. This means that an extra bit, or 9th bit is used to control the X position. By adding the extra bit when necessary a sprite now has 512 possible positions in the left/right, X, direction. This makes more possible combinations than can be seen on the visible part of the screen. Each sprite can have a position from 0 to 511. However, only those values between 24 and 343 are visible on the screen. If the X position of a sprite is greater than 255 (on the right side of the screen), the bit in the X MOST SIGNIFICANT BIT POSITION


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