voila premier pas dans l'univers de l'open sources francais sur gba...
ICI se trouve un zip avec une source(celle qui est un peut plus bas) et la rom compilé.....
ce prog est mon premier prog, c'est l'affichage de dégrader de couleur sur l'ecran de la gba, en dégradé horizontaux.....
voila la source ici, ou dans le
ZIP:
/* quick mode 4 rectangle ploter */
static long randBuffer;
static int
getRandomInt( int max )
{
int temp = (int)(((randBuffer = randBuffer * 214013 + 2531011) >> 16) & 0x7FFF);
return (temp * max) >> 15;
}
void wait4Vsync()
{
volatile unsigned short * vpos = ((volatile unsigned short *)(0x04000006));
while( *vpos < 160 )
/* busy loop */ ;
}
void plotRect( int x, int y, int w, int h, unsigned short colour )
{
int ww;
unsigned short * scrn = ((unsigned short*)0x06000000);
while( h > 0 )
{
ww = w;
while( --ww >= 0 )
{
scrn[x+ww+y*240]= colour;
}
y++;
h--;
}
}
int main()
{ int b=0, c=0;
randBuffer = 0x5344;
*((unsigned short *)0x04000000) = 0x0403; /* enable screen 2, and set mode 3 */
debut:
b=0;
for(b=0;b<=160;b++)
{c+=2;
wait4Vsync();
plotRect( 0, b, 240, 1, c);}
goto debut;
}
[edit]Edité par misato le 27-12-2001 à 13:07:32[/edit]