Fast Sprite Grabbing Routines



void Sprite8Get(short x,short y,short h,void* src,unsigned char* dest) __attribute__((__stkparm__));

void Sprite8Get_R(register short x asm("%d0"),register short y asm("%d1"),register short h asm("%d2"),register void* src asm("%a0"),register unsigned char* dest asm("%a1")) __attribute__((__regparm__));

void Sprite16Get(short x,short y,short h,void* src,unsigned short* dest) __attribute__((__stkparm__));

void Sprite16Get_R(register short x asm("%d0"),register short y asm("%d1"),register short h asm("%d2"),register void* src asm("%a0"),register unsigned short* dest asm("%a1")) __attribute__((__regparm__));

void Sprite32Get(short x,short y,short h,void* src,unsigned long* dest) __attribute__((__stkparm__));

void Sprite32Get_R(register short x asm("%d0"),register short y asm("%d1"),register short h asm("%d2"),register void* src asm("%a0"),register unsigned long* dest asm("%a1")) __attribute__((__regparm__));

void SpriteX8Get(short x,short y,short h,void* src,unsigned char* dest,short bytewidth) __attribute__((__stkparm__));

void SpriteX8Get_R(register short x asm("%d0"),register short y asm("%d1"),register short h asm("%d2"),register void *src asm("%a1"),register unsigned char *dest asm("%a0"),register short bytewidth asm("%d3")) __attribute__((__regparm__));


SpriteXGet copies a sprite from the screen at x and y to dest. This routine is many times faster than the TIOS routine BitmapGet. Additonally sprites retrieved using SpriteXGet can be used as arguments for all the Sprite routines found in this header, unlike the bitmaps obtained with BitmapGet. x and y are the coordinates of the upper left corner of the sprite. h is the height of the sprite. src is a pointer to a video plane of size 240x128 pixels from which one wants to retrieve the sprite. dest is the pointer to a buffer (array) which is large enough to store the fetched sprite data.

The SpriteX8Get function differs from the rest of the functions. It is not fixed to a specific width, but you can specify the width in bytes as parameter (bytewidth). The sprite data fetched by SpriteX8Get is organized like this (example for bytewidth == 3): line1/byte1, line1/byte2, line1/byte3, line2/byte1, line2/byte2, line2/byte3 etc.

You can use SpriteX8Get_R twice to simulate "FastCopyRectangleX8_R" (see Fast...RectanglesX8_R in another section).