gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

C/C++ > Colors all wrong

#50463 - triton - Tue Aug 09, 2005 11:08 pm

Took poslundc's advice and took up coding in C. My first background, 256 * 256 and colors all wrong. Please help

#include "bg.h"
#define us *(unsigned short*)
#define uc *(unsigned char*)
#define ul *(unsigned long*)
int main()
{
volatile unsigned short *video=(unsigned short*) 0x6000000;
*(unsigned short*)0x4000000=(0x0400);

while(1)
{
us 0x400000c=0x1480;
ul 0x40000d4=bg1pal;
ul 0x40000d8=0x5000000;
ul 0x40000dc=0x94000080;
ul 0x40000d4=bg1;
ul 0x40000d8=0x6000000;
ul 0x40000dc=0x94004000;
ul 0x40000d4=bg1map;
ul 0x40000d8=0x600a000;
ul 0x40000dc=0x94000200;
}
}

#50464 - sajiimori - Tue Aug 09, 2005 11:13 pm

I don't see anything useful that your code could do. Try following some tutorials and copying examples.

#58479 - yuriks - Sun Oct 23, 2005 10:43 pm

Triton, you should really start to use header files...
_________________
---yuriks---

#58583 - Miked0801 - Mon Oct 24, 2005 6:50 pm

Wow. Good first try. Now, the tutorials would be the next place to look as per the others.

#58610 - Mucca - Mon Oct 24, 2005 9:49 pm

Or just write your whole game directly in binary.