#21529 - tornadokick - Mon May 31, 2004 2:06 am
Hey, I'm trying to get into this gba programming (so I'm new), and I was messing around with one of the tutorials. Alright. What I was trying to do was create an array which would hold information for the different colors, and then copy that array onto the screen. The Problem is that the program freezes. I've tried everything I could think of, but nothing changes. This is what I have:
It seems that the program freezes in the first for loop. If I comment that out, the program continues and goes to the second loop
Might the gba not be able to handle something like that?
Any help is appreciated.
Code: |
#include <math.h> //sign and cos stuff #include "gba.h" //GBA register definitions #include "dispcnt.h" //REG_DISPCNT register #defines #include "keypad.h" //button registers //#include "bg.h" //background definitions //#include "function.h" #define RGB(r,g,b) ((r) + ((g)<<5) + ((b)<<10)) u16* videoBuffer = (u16*) 0x6000000; void PlotPixel(int x, int y, unsigned short int c) { videoBuffer[y*240 + x] = c; } int main() // start of program { SetMode(MODE_3 | BG2_ENABLE); unsigned short int screen [240][160]; for (int i = 0; i < 240; i++) { for (int j = 0; j < 160; j++) { screen[i][j] = RGB(31,31,31); // most likely freezes here } } for(int x = 0; x < 240; x++) { for(int y = 0; y < 160; y++) { PlotPixel(x, y, RGB(30,0,0)); //screen[x][y]); } } return 0; } |
It seems that the program freezes in the first for loop. If I comment that out, the program continues and goes to the second loop
Might the gba not be able to handle something like that?
Any help is appreciated.