Re: A86: Sprite Routines


[Prev][Next][Index][Thread]

Re: A86: Sprite Routines




>I am just learning how to do sprites, and I was wondering what the
>difference between normal sprite routine (FastSprite) and a sprite
>clipping routine (ASCR)? Thanks for your help.

It seems everyone wants to know this, so I'll try my best to explain all
the types of sprites.  There are three different types of sprite drawing
routines:

1) Alligned sprites or gridput sprites:  With this type of routine, sprites
are drawn to the screen in a 16x8 grid.  The reason they are called
alligned is because each byte of the sprite fits evenly into a byte of
video memory.  There is no shifting to write to multiple bytes of video
memory.  The screen is 16 bytes across by 16 bytes up and down, and each
sprite is 8 bytes up/down, hence the 16x8 grid (assuming you are using 8x8)
sprites.  You must also remember that there are 8 pixels/byte in video
memory.  These are by far the easiest and fastest sprites to draw.

2) Normal sprites or putsprite sprites:  These sprites are drawn anywhere
in video memory.  Since they are not usually alligned, the bytes must be
shifted in order to be drawn correctly.  They are not clipped, so if they
run off the screen, they will either wrap around incorrectly or write to
other memory and possibly crash the calculator.  These are reasonably fast
to draw.

3) Clipped sprites, most likely being drawn with Jimmy Mardell's ASCR:
These sprites are like normal sprites, only they are clipped.  Clipping
means that if part of them is off the screen, only the visible part will be
drawn.  The ASCR routines contain a routine to just draw an 8x8 clipped
sprite, and a routine to draw an 8x8 masked sprite along with saving the
background behind the sprite as an 8x8 sprite.  These are the slowest
sprites to draw, but they are also very useful.

There are also 2 different types of sprites:

1) Unmasked:  These are just normal 8x8 sprites that take up 8 pixels/byte,
or 8 bytes.

2) Masked:  These are 8x16 sprites, or two 8x8 sprites where the first 8
bytes are the actual sprite, and the second 8 bytes are the mask.   The
mask indicates whether or not the pixels are transparent or solid.

I hope this helps.  Email me for any questions/clarifications.


--
David Phillips
mailto:electrum@tfs.net
ICQ: 13811951
AOL/AIM: Electrum32


References: