GP32 GP32 Dev with GCC


esoteric_

Member
Joined
Dec 19, 2002
Messages
112
Hey,

This doesn't look like to active a section of the board, but it's worth a shot for me, I think.

Alright, I've downloaded DevKitAdvance and also the GP32 patch for it. I've got it all set up and GPTest works perfectly.

Now, last time I coded in C was back in DOS, so from what I remember, I'd just set up a pointer to video memory and just start dumping values in to get pixels.

I'm hoping to find some fast way to do this with GCC, or is there a better method?

Basically, I just wanna get started plotting pixels in a large array so I can manipulate things.

(Also, as a side note, I haven't found any solid information on the differences between 8-bit mode and 16-bit mode... actually, all the documentation is pretty sketchy.... :/)

Any ideas, folks? Thanks..

Arlo
 
#include <gp32/gp32.h>
#include <gp32/gpmisc.h>

GPDRAWSURFACE gpDraw[2];

void GpMain (void * arg)
{

int *t,cnt,i,j;
GpGraphicModeSet(8, t);
GpLcdSurfaceGet(&gpDraw[0], 0);
GpLcdSurfaceGet(&gpDraw[1], 1);
GpSurfaceSet(&gpDraw[0]);
GpLcdEnable();

GpSurfaceFlip(&gpDraw[0]);

u8 *screen;

// set palette here (it's default set to all black so you have to set it to see anything
for (i=0; i<256; i++) GpSetPaletteEntry(i,GP_RGB24(i,i,i));

while (1) {

screen=gpDraw[cnt&1].ptbuffer;

for (i=0; i<320; i++)
for (j=0; j<240; j++) screen[i*240+j] = i+j;

GpSurfaceSet(&gpDraw[cnt&1]);

cnt++;
}

afm_deinit();

}

I hope this helps. I don't know if this works perfectly, but it should do at least something.

Remember that your screen isn't 320x240 but 240x320 (it's rotated 90 degrees counterclockwards compared to the rest of the machine)

have fun

/Inopia
 
Back
Top