#7987 - jcpredator - Mon Jun 30, 2003 12:38 am
When I try to load my first attempt at using tile modes into VBA I get the following results:
[Images not permitted - Click here to view it]
Here is the code:
Any help would be greatly appreciated, thanks...
_________________
There is no spoon...
[Images not permitted - Click here to view it]
Here is the code:
Quote: |
// Defines For Constants/Boolean //
#define boolean unsigned char #define true 1 #define false 0 #define SCREEN_MAX_X 240 #define SCREEN_MAX_Y 160 /////////////////////////////////// // Required Included Files // #include <predo_start.c> #include <dispcnt.h> #include <gba.h> #include <keypad.h> #include <Bg.h> #include <tile_test.h> #include <test_tile_map.c> ///////////////////////////// // Structures for Sprites/BGs // typedef struct OAMEntry { u16 attribute0; u16 attribute1; u16 attribute2; u16 attribute3; } OAMEntry; OAMEntry sprites[128]; void titleScreen(void); void initGameMode(void); void Wait(u16 seconds); void enableBackground(Bg* bg); void AgbMain(void) { titleScreen(); initGameMode(); while(1); } void titleScreen(void) { u16 loop, x, y; SetMode(MODE_3 | OBJ_MAP_1D | BG2_ENABLE | OBJ_ENABLE); for(y=0;y<SCREEN_MAX_Y; y++) for(x=0;x<SCREEN_MAX_X; x++) VideoBuffer[y*SCREEN_MAX_X+x] = predodata[y*SCREEN_MAX_X+x]; while(1) { if(!(*KEYS & KEY_START)) break; } for(loop=0; loop<38400; loop++) VideoBuffer[loop] = 0x0000; } void initGameMode(void) { u16 loop; u16* temp; SetMode(MODE_0 | OBJ_MAP_1D | BG0_ENABLE | BG1_ENABLE | BG2_ENABLE | BG3_ENABLE | OBJ_ENABLE);// Mode 0, OBJ Enabled, All BG's Bg Bg3; Bg3.number = 3; Bg3.charBaseBlock = 0; Bg3.screenBaseBlock = 28; Bg3.colorMode = BG_COLOR_256; Bg3.size = TEXTBG_SIZE_256x256; Bg3.mosaic = 0; Bg3.x_scroll = 120; Bg3.y_scroll = 80; enableBackground(&Bg3); for(loop=0;loop<256;loop++) { BGPaletteMem[loop] = tile_testPalette[loop]; } for(loop=0;loop<tile_test_WIDTH * tile_test_HEIGHT /2;loop++) { Bg3.tileData[loop] = tile_testData[loop]; } temp = (u16*)test_tile_map; for(loop=0;loop<16*16/2;loop++) Bg3.mapData[loop] = temp[loop]; } void Wait(u16 seconds) { //Start the timer REG_TM0CNT = 0x0 | 0x80; //zero the timer REG_TM0D = 0; while(seconds--) { while(REG_TM0D <= 16386){} //wait REG_TM0D = 0; //reset the timmer } } void enableBackground(Bg* bg) { u16 temp; bg->tileData = (u16*)CharBaseBlock(bg->charBaseBlock); bg->mapData = (u16*)ScreenBaseBlock(bg->screenBaseBlock); temp = bg->size | (bg->charBaseBlock<<SCREEN_SHIFT)| bg->colorMode | bg->mosaic; switch(bg->number) { case 0: { REG_BG0CNT = temp; REG_DISPCNT |= BG0_ENABLE; }break; case 1: { REG_BG1CNT = temp; REG_DISPCNT |= BG1_ENABLE; }break; case 2: { REG_BG2CNT = temp; REG_DISPCNT |= BG2_ENABLE; }break; case 3: { REG_BG3CNT = temp; REG_DISPCNT |= BG3_ENABLE; }break; default:break; } } |
Any help would be greatly appreciated, thanks...
_________________
There is no spoon...