May be i am wrong , but...
// Pixels physical range are: for x - 0...239 !!! and for y - 0...319
void gp_SetPixel16 ( int x, int y, u16 c, u16 *framebuffer )
{
// unsigned short *addr;
//addr = framebuffer;
// do not check coordinates check !
// y%240 and x%320 - this is very bad code . Avoid divisions as much as possible !
// You must sub from 240 one to have correct physical x coordinate range
*(framebuffer + (240 - 1- y) + (240 * x) = c;
}
void gp_SetScreen(u32 addr,u16 bitmode) {
{
u16 BPPMODE = 12; // default 16 Bit
u16 CLKVAL = 3;
u16 ENVID = 1;
u16 MMODE = 0;
u16 PNRMODE = 3;
u16 LINECNT = 0;
switch (bitmode) {
//case 16 : BPPMODE=12; break; // do not need this one, you already set it !
case 8 : BPPMODE=11; break;
case 4 : BPPMODE=10; break;
case 2 : BPPMODE= 9; break;
case 1 : BPPMODE= 8; break;
}
// Pixels physical range are: for x - 0...239 !!! and for y - 0...319
void gp_SetPixel16 ( int x, int y, u16 c, u16 *framebuffer )
{
// unsigned short *addr;
//addr = framebuffer;
// do not check coordinates check !
// y%240 and x%320 - this is very bad code . Avoid divisions as much as possible !
// You must sub from 240 one to have correct physical x coordinate range
*(framebuffer + (240 - 1- y) + (240 * x) = c;
}
void gp_SetScreen(u32 addr,u16 bitmode) {
{
u16 BPPMODE = 12; // default 16 Bit
u16 CLKVAL = 3;
u16 ENVID = 1;
u16 MMODE = 0;
u16 PNRMODE = 3;
u16 LINECNT = 0;
switch (bitmode) {
//case 16 : BPPMODE=12; break; // do not need this one, you already set it !
case 8 : BPPMODE=11; break;
case 4 : BPPMODE=10; break;
case 2 : BPPMODE= 9; break;
case 1 : BPPMODE= 8; break;
}