Author Topic: [Resolved] GCC4TI - ClipSpirte8  (Read 6953 times)

0 Members and 1 Guest are viewing this topic.

Offline Torio

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +22/-0
    • View Profile
[Resolved] GCC4TI - ClipSpirte8
« on: August 23, 2012, 07:56:23 am »
The ClipSpriteX functions doesn't seem to work in GCC4TI...

This code can compile but the screen doesn't show up any pokeball :
Code: [Select]
// C Source File
// Created 8/23/2012; 1:28:04 PM

#include <tigcclib.h>

// Main Function
void _main(void)
{
unsigned char pkball[5] =
  {0x70,0x88,0xF8,0x88,0x70};
  
  ClrScr();
  ClipSprite8(10, 10, 5, pkball, LCD_MEM, SPRT_XOR);
  ngetchx();
}

Is it an error from me or is there a bug in the GCC4TI lib ?

Torio
« Last Edit: August 24, 2012, 08:54:10 am by Torio »
Sorry about my mistakes, I'm French.

Projects :  Pokemon TI-89 | Ti-Tank

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: GCC4TI - ClipSpirte8
« Reply #1 on: August 23, 2012, 08:59:41 am »
Well, your example works for me (as the maintainer, GCC4TI Git HEAD): it does show a pokeball at 10,10.
Please post the TPR, so that I can compile with the exact same compilation options as yours.

ClipSprite8/16/32 routines have been added to GCC4TI after the 0.96 Beta 10 release, so I take it that you're compiling GCC4TI yourself (which is fantastically easier than compiling TIGCC :D) ?
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline Torio

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +22/-0
    • View Profile
Re: GCC4TI - ClipSpirte8
« Reply #2 on: August 23, 2012, 10:22:19 am »
I don't understand what do you mean by "compiling GCC4TI myself" ?

Anyway, you can find my TPR in attachment.
Sorry about my mistakes, I'm French.

Projects :  Pokemon TI-89 | Ti-Tank

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: GCC4TI - ClipSpirte8
« Reply #3 on: August 23, 2012, 11:02:37 am »
Quote
I don't understand what do you mean by "compiling GCC4TI myself" ?
Then you probably are not compiling GCC4TI yourself :)
I meant: updatesrc, scripts/Install, the INSTALL file for *nix, etc.

Indeed, your executable does not produce the intended effect; but when I recompile it, it's eight bytes smaller, and it works :)
What exact version of GCC4TI are you using ? 0.96 Beta 10 with, or without the errata ?
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline Torio

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +22/-0
    • View Profile
Re: GCC4TI - ClipSpirte8
« Reply #4 on: August 23, 2012, 11:08:41 am »
Quote
Then you probably are not compiling GCC4TI yourself
I meant: updatesrc, scripts/Install, the INSTALL file for *nix, etc.

Never heard about all that stuff, so I guess I don't compile GCC4TI myself.

Quote
What exact version of GCC4TI are you using ? 0.96 Beta 10 with, or without the errata ?

I'm using GCC4TI 0.96 Beta 10.
For the errata, if you mean to ask if I followed the process described here : http://trac.godzil.net/gcc4ti/wiki/SprtRoutinesFix, yes I did the modification.
Sorry about my mistakes, I'm French.

Projects :  Pokemon TI-89 | Ti-Tank

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: GCC4TI - ClipSpirte8
« Reply #5 on: August 23, 2012, 12:01:03 pm »
Odd, as the clipsprite*.s files haven't been modified since then...

What if you add https://github.com/debrouxl/gcc4ti/raw/a5bbc0d617cf0894294cc7a24f47abaaae2e8b03/trunk/tigcc/archive/clipsprite8.s to your project ?
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline Torio

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +22/-0
    • View Profile
Re: GCC4TI - ClipSpirte8
« Reply #6 on: August 24, 2012, 04:49:31 am »
I downloaded the clipsprite8.s and then added it to my project by selecting Project->Add Files.
But it doesn't work neither... I'm using Vti Version 2.5 beta 5, with the TI-89 ROM version 2.01.
Sorry about my mistakes, I'm French.

Projects :  Pokemon TI-89 | Ti-Tank

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: GCC4TI - ClipSpirte8
« Reply #7 on: August 24, 2012, 05:11:40 am »
Then your environment clearly doesn't have the proper definitions for ClipSprite* functions.
In fact, that's exactly what should occur if you didn't add these definitions to $TIGCC/include/c/sprites.h, and the procedure for doing so is not described on the SprtRoutinesFix page ;)

Disassembling your program shows that indeed, your compiler hasn't properly passed the arguments to ClipSprite8, while it does for me because I have the appropriate definitions since more than three years ago.
However, the compiler does warn you about the problem: "implicit declaration of function 'ClipSprite8'". Implicit declarations of functions are bad, like the vast majority of compiler warnings: you should pay attention to compiler warnings ;)

To fix the problem on your side, remove the clipsprite8.s file from your project, and update your sprites.h to contain the following content:
Code: [Select]
#ifndef __SPRITES
#define __SPRITES

#include <default.h>

/* Begin Auto-Generated Part */
enum SprtModes{SPRT_XOR,SPRT_OR,SPRT_AND,SPRT_RPLC};
extern 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__;
extern void ClipSprite16(short asm("d0"),short asm("d1"),short asm("d2"),__cpushort asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__;
extern void ClipSprite32(short asm("d0"),short asm("d1"),short asm("d2"),__cpulong asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__;
extern 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__;
extern void Sprite16(short asm("d0"),short asm("d1"),short asm("d2"),__cpushort asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__;
extern void Sprite32(short asm("d0"),short asm("d1"),short asm("d2"),__cpulong asm("a0"),void* asm("a1"),short asm("d3"))__ATTR_LIB_ASM__;
/* End Auto-Generated Part */

#endif


And BTW, 2.01 through 2.04 are older OS versions with fewer exported functions (especially math ones) and well-known data loss bugs. Not that it matters much for games and in an emulator, but you should use OS 2.05 instead of 2.01 ;)


EDIT: I have changed http://trac.godzil.net/gcc4ti/wiki/SprtRoutinesFix and https://github.com/debrouxl/gcc4ti/wiki/SprtRoutinesFix .
« Last Edit: August 24, 2012, 05:19:49 am by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline Torio

  • LV3 Member (Next: 100)
  • ***
  • Posts: 83
  • Rating: +22/-0
    • View Profile
Re: GCC4TI - ClipSpirte8
« Reply #8 on: August 24, 2012, 05:27:51 am »
Bravo ! It works perfectly now.
Thank you very much !
Sorry about my mistakes, I'm French.

Projects :  Pokemon TI-89 | Ti-Tank