#177312 - tuket - Fri Apr 06, 2012 12:30 am
I have created a very simple game for gba and it work in the amulator but not in the cartridge. I have an EZ flash IV. It is just a red pixel that moves on the screen. When I start the game in the gameboy it apears the leters of GAMEBOY but where it should be written NINTENDO there are some random pixels like when it has dust inside. Here is the code
I hope you can help me. :)
Code: |
#define RGB16(r,g,b) ((r)+(g<<5)+(b<<10))
#include "keypad.h" unsigned short* Screen = (unsigned short*)0x6000000; void showpo(char* x,char* y); void dele(char* x, char* y); int main() { *(unsigned long*)0x4000000 = 0x403; // mode3, bg2 on struct p{ char x; char y; }; struct p p={0,0}; showpo(&p.x,&p.y); char x,y; // clear screen, and draw a blue back ground for(x = 0; x<240;x++) //loop through all x { for(y = 0; y<160; y++) //loop through all y { Screen[x+y*240] = RGB16(0,0,0); } } while(1){ if(!((*KEYS) & KEY_UP)){dele(&p.x,&p.y);--p.y;showpo(&p.x,&p.y);} if(!((*KEYS) & KEY_DOWN)){dele(&p.x,&p.y);++p.y;showpo(&p.x,&p.y);} if(!((*KEYS) & KEY_RIGHT)){dele(&p.x,&p.y);++p.x;showpo(&p.x,&p.y);} if(!((*KEYS) & KEY_LEFT)){dele(&p.x,&p.y);--p.x;showpo(&p.x,&p.y);} char i; for(i=0;i<100;i++){ char j; for(j=0;j<100;j++); } } //loop forever } void showpo(char* x,char* y){ Screen[(*x)+(*y)*240]=RGB16(31,0,0); } void dele(char* x, char* y){ Screen[(*x)+(*y)*240]=RGB16(0,0,0); } |
I hope you can help me. :)