Changeset 1361


Ignore:
Timestamp:
07/24/09 18:55:32 (3 years ago)
Author:
debrouxl
Message:

library: add ClipSprite8/16/32 routines (with explicit register parameters) and some documentation.
These routines are based on an implementation by Joey Adams, contributed to TIGCC in 2005 (at the same time as the Sprite* merged in GCC4TI several weeks ago).

Location:
trunk/tigcc
Files:
6 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/tigcc/archive/tigcc.tpr

    r1345 r1361  
    436436GNU Assembler File 218=sprite16.s 
    437437GNU Assembler File 219=sprite32.s 
    438 GNU Assembler File 220=ptrtohandle.s 
     438GNU Assembler File 220=clipsprite8.s 
     439GNU Assembler File 221=clipsprite16.s 
     440GNU Assembler File 222=clipsprite32.s 
     441GNU Assembler File 223=ptrtohandle.s 
    439442Text File 1=License.txt 
    440443Text File 2=startup\Startup.txt 
  • trunk/tigcc/doc/System/Include/sprites.h/Sprite16.hsf

    r1360 r1361  
    66Definition=void Sprite16 (short x, short y, short height, const unsigned short *sprite, void *vm_addr, short mode); 
    77Real Definition=extern void Sprite16(short asm("d0"),short asm("d1"),short asm("d2"),__cpushort asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__; 
     8See Also=sprites.h/ClipSprite16 
    89 
    910[Library Call] 
     
    2728<PRE>static const unsigned short sprite[] = {...}; 
    2829</PRE> 
    29 See <A HREF="$$LINK(sprites.h/Sprite8)">Sprite8</A> for more info about sprites. 
     30See <A HREF="$$LINK(sprites.h/Sprite8)">Sprite8</A> for more info about sprites, and 
     31<A HREF="$$LINK(sprites.h/ClipSprite16)">ClipSprite16</A> for a version that handles out-of-screen sprites gracefully. 
  • trunk/tigcc/doc/System/Include/sprites.h/Sprite32.hsf

    r1360 r1361  
    66Definition=void Sprite32 (short x, short y, short height, const unsigned long *sprite, void *vm_addr, short mode); 
    77Real Definition=extern void Sprite32(short asm("d0"),short asm("d1"),short asm("d2"),__cpulong asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__; 
     8See Also=sprites.h/ClipSprite32 
    89 
    910[Library Call] 
     
    4748</UL> 
    4849<BR><BR> 
    49 See <A HREF="$$LINK(sprites.h/Sprite8)">Sprite8</A> for more info about sprites. 
     50See <A HREF="$$LINK(sprites.h/Sprite8)">Sprite8</A> for more info about sprites, and 
     51<A HREF="$$LINK(sprites.h/ClipSprite32)">ClipSprite32</A> for a version that handles out-of-screen sprites gracefully. 
  • trunk/tigcc/doc/System/Include/sprites.h/Sprite8.hsf

    r1360 r1361  
    55Header Files=sprites.h 
    66Definition=void Sprite8 (short x, short y, short height, const unsigned char *sprite, void *vm_addr, short mode); 
     7See Also=sprites.h/ClipSprite8 
    78 
    89[Library Call] 
     
    2122 
    2223[Explanation] 
    23 Sprite8 draws a sprite with a width of 8 pixels or less on the screen. 
    24 Use <A HREF="$$LINK(sprites.h/Sprite16)">Sprite16</A> or <A HREF="$$LINK(sprites.h/Sprite32)">Sprite32</A> for wider sprites. 
    25 This routine is many times faster than TIOS routines like 
    26 <A HREF="$$LINK(graph.h/DrawIcon)">DrawIcon</A>, <A HREF="$$LINK(graph.h/BitmapPut)">BitmapPut</A>, etc. 
     24Sprite8 draws a sprite with a width of 8 pixels or less on the screen. See <A HREF="$$LINK(sprites.h/ClipSprite8)">ClipSprite8</A> 
     25for a version that handles out-of-screen sprites gracefully, and <A HREF="$$LINK(sprites.h/Sprite16)">Sprite16</A>, <A HREF="$$LINK(sprites.h/ClipSprite16)">ClipSprite16</A>, 
     26<A HREF="$$LINK(sprites.h/Sprite32)">Sprite32</A> or <A HREF="$$LINK(sprites.h/ClipSprite32)">ClipSprite32</A> for wider sprites. 
     27This routine is much faster than TIOS routines such as <A HREF="$$LINK(graph.h/DrawIcon)">DrawIcon</A>, 
     28<A HREF="$$LINK(graph.h/BitmapPut)">BitmapPut</A>, etc. 
    2729<I>x</I> and <I>y</I> are the coordinates of the upper left corner of the sprite. 
    2830<I>height</I> is the height of the sprite. <I>sprite</I> is a pointer to the array of 
     
    8486very useful. Note that '~' is "bitwise NOT". Of course, ~0xFF is the same as 0x00, but this notation 
    8587makes the program more clear (and it does not increase the code size, because the inverting will 
    86 be performed at compilation time). And if you want to use <A HREF="$$LINK(sprites.h/Sprite16)">Sprite16</A> or 
    87 <A HREF="$$LINK(sprites.h/Sprite32)">Sprite32</A>, the notation ~0xFF will still be valid in a short int array, or in a long int array 
    88 if you add the <B>'L'</B> suffix (see the respective info about <A HREF="$$LINK(sprites.h/Sprite32)">Sprite32</A>). 
    89 Without this notation, you must use 0x00 in Sprite8, but 0xFF00 in <A HREF="$$LINK(sprites.h/Sprite16)">Sprite16</A>, and 
    90 0xFFFFFF00 in <A HREF="$$LINK(sprites.h/Sprite32)">Sprite32</A>. This is why a notation like ~0xFF is more universal. 
     88be performed at compilation time). And if you want to use <A HREF="$$LINK(sprites.h/Sprite16)">Sprite16</A>, 
     89<A HREF="$$LINK(sprites.h/ClipSprite16)">ClipSprite16</A>, <A HREF="$$LINK(sprites.h/Sprite32)">Sprite32</A> or 
     90<A HREF="$$LINK(sprites.h/ClipSprite32)">ClipSprite32</A>, the notation ~0xFF will still be valid in a short int 
     91array, or in a long int array if you add the <B>'L'</B> suffix (see the respective info about 
     92<A HREF="$$LINK(sprites.h/Sprite32)">Sprite32</A> and <A HREF="$$LINK(sprites.h/ClipSprite32)">ClipSprite32</A>). 
     93Without this notation, you must use 0x00 in Sprite8, but 0xFF00 in 
     94<A HREF="$$LINK(sprites.h/Sprite16)">Sprite16</A>/<A HREF="$$LINK(sprites.h/ClipSprite16)">ClipSprite16</A>, and 
     950xFFFFFF00 in <A HREF="$$LINK(sprites.h/Sprite32)">Sprite32</A>/<A HREF="$$LINK(sprites.h/ClipSprite32)">ClipSprite32</A>. 
     96This is why a notation like ~0xFF is more universal. 
    9197<BR><BR> 
    9298Starting from TIGCC v0.91, you can use binary numbers to define your sprites. On the one hand, 
  • trunk/tigcc/include/C/sprites.h

    r1360 r1361  
    66/* Begin Auto-Generated Part */ 
    77enum SprtModes{SPRT_XOR,SPRT_OR,SPRT_AND,SPRT_RPLC}; 
     8extern void ClipSprite8(short asm("d0"),short asm("d1"),short asm("d2"),const unsigned char* asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__; 
     9extern void ClipSprite16(short asm("d0"),short asm("d1"),short asm("d2"),__cpushort asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__; 
     10extern void ClipSprite32(short asm("d0"),short asm("d1"),short asm("d2"),__cpulong asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__; 
    811extern void Sprite8(short asm("d0"),short asm("d1"),short asm("d2"),const unsigned char* asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__; 
    912extern void Sprite16(short asm("d0"),short asm("d1"),short asm("d2"),__cpushort asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__; 
Note: See TracChangeset for help on using the changeset viewer.