Omnimaga

Calculator Community => TI Calculators => Calculator C => Topic started by: blue_bear_94 on November 30, 2012, 04:13:53 pm

Title: [68k] Incorrect Cursor Drawing
Post by: blue_bear_94 on November 30, 2012, 04:13:53 pm
I decided to start using the latest GCC4TI release, but my graphic editing program now has a cursor glitch! (screenshot attached, along with how it's supposed to look)
My source code is also attached.
My code to draw the cursor is as follows:
Code: [Select]
void drawCursor(unsigned int x,unsigned int y) //Draws the cursor
{
unsigned char cursorl[8] = {
~0x80,~0xC0,~0xA0,~0x90,~0xB8,~0xE0,~0x90,~0x08
};
unsigned char cursord[8] = {
~0x80,~0xC0,~0xE0,~0xF0,~0xF8,~0xE0,~0x90,~0x08
};
unsigned char cursorm[8] = {
~0x7F,~0x3F,~0x1F,~0x0F,~0x07,~0x1F,~0x6F,~0xF7
};

Sprite8(x,y,8,cursorm,GrayGetPlane(LIGHT_PLANE),SPRT_AND);
Sprite8(x,y,8,cursorm,GrayGetPlane(DARK_PLANE),SPRT_AND);
Sprite8(x,y,8,cursorl,GrayGetPlane(LIGHT_PLANE),SPRT_OR);
Sprite8(x,y,8,cursord,GrayGetPlane(DARK_PLANE),SPRT_OR);
}

This code worked as intended on TIGCC 0.96 Beta 8, but shows the wrong cursor on GCC4TI 0.96 Beta 10. Any help would be appreciated!
Title: Re: [68k] Incorrect Cursor Drawing
Post by: Lionel Debroux on November 30, 2012, 04:19:32 pm
After installing GCC4TI 0.96 Beta 10, have applied the hotfixes which are duly mentioned on the official download pages ? ;)
Title: Re: [68k] Incorrect Cursor Drawing
Post by: blue_bear_94 on November 30, 2012, 04:31:43 pm
I now did, and when I try to build the program, a lot of errors appear.
"Storage class specified for parameter '...'."
EDIT: Never mind, I compiled it successfully!
Title: Re: [68k] Incorrect Cursor Drawing
Post by: Lionel Debroux on December 01, 2012, 02:14:29 am
BTW, you should mark the sprite definitions "const", and either move them out of the function, or let them in the function but mark them "static" :)
As the code snippet above stands, it needlessly creates the variables on the stack, which takes significantly more space than having a const copy statically stored in the program.