#177962 - aidan_aidan - Wed Jun 12, 2013 2:55 pm
[Images not permitted - Click here to view it]
The corruption as you can see is in the lower area of the screen, starting at tile number 512 (block 1). The corruption extends all the way back to the tiles library itself in the Character block, I now this from viewing it in Visual boy. I have spent many hours to no avail trying to figure out the problem and am tired of trying. So I have turned to the forums. I will now post the relevant code.
C FILE WITH MAIN FUNCTION
I am not really sure what to include so if anything isn't clear please ask.[/code]
_________________
French re f draft free e w shredder for c rt
The corruption as you can see is in the lower area of the screen, starting at tile number 512 (block 1). The corruption extends all the way back to the tiles library itself in the Character block, I now this from viewing it in Visual boy. I have spent many hours to no avail trying to figure out the problem and am tired of trying. So I have turned to the forums. I will now post the relevant code.
C FILE WITH MAIN FUNCTION
Code: |
#include <..\include\toolbox.h> #include <..\include\palettes.h> #include <..\include\tileset.h> #include <..\include\sprites.h> #include <..\include\samples.h> #include <..\include\text.h> #include <..\include\bitmaps.h> u32 starXoff = 0, starYoff = 0, shipX = 10, shipY = 72; void tm1Interrupt(void); void interruptHandler(void); void meleeMode(void); void introScreen(void); void playSound(u32 frequency, const u32* soundLoc, u32 length); void displayText(u32 length, const char string[], u32 colorIndex); int main(void){ introScreen(); while(1){} return(0); } /* void initRegisters(){ REG_ISR_MAIN = interruptHandler; SOUNDCNT_H = (SOUND_HVOLUME100 | SOUND_HAVOLUME100 | SOUND_HBVOLUME0 | SOUND_HAENABLERIGHT | SOUND_HAENABLELEFT | SOUND_HATIMER0 | SOUND_HBDISABLERIGHT | SOUND_HBDISABLELEFT | SOUND_HBTIMER0); SOUNDCNT_X = (SOUND_XFIFOME); INTERRUPTME = (IME_ENABLE); INTERRUPTE = (INTERRUPT_TM1); } */ void introScreen(){ u32 x, y; u16 vBlankBool_A = 0, vBlankBool_B = 0; DISPCNT = (MODE0 | BG0_ENABLE | BG1_ENABLE); BG0CNT = (CBB0 | BGCOLOR256 | SBB16 | BG_REG_32x32); BG1CNT = (CBB3 | BGCOLOR16 | SBB1 | BG_REG_32x32); for(x = 0; x < INTROSETLENGTH; x++){ CBB0_U32_LOC[x] = introSet[x]; } for(x = 0; x < 30; x++){ for(y = 0; y < 20; y++){ SBB16_U16_LOC[(y * 30) + x + (y * 2)] = (x + (y * 30)); } } for(x = 0; x < BGINTROPALETTELENGTH; x++){ BGPAL[x] = bgIntroPalette[x]; } while(1){ vBlankBool_A = (DISPSTAT & VBLANKFLAG); if(vBlankBool_A & ~vBlankBool_B){ } vBlankBool_B = vBlankBool_A; } } void meleeMode(){ u32 i, tile0, tile1, flip0, flip1, index0, index1; u16 vBlankBool_A = 0, vBlankBool_B = 0; DISPCNT = (MODE0 | BG0_ENABLE | BG1_ENABLE | BG2_ENABLE | BG3_ENABLE | OBJ_ENABLE | OBJ1D); BG1CNT = (BG_REG_64x32 | SBB16 | CBB0 | BGCOLOR16); BG2CNT = (BG_REG_64x32 | SBB18 | CBB0 | BGCOLOR16); BG3CNT = (BG_REG_64x32 | SBB20 | CBB0 | BGCOLOR16); for(i = 0; i < BGMELEEMODEPALETTELENGTH; i++){ BGPAL[i] = bgMeleeModePalette[i]; } for(i = 0; i < STARSETLENGTH; i++){ CBB0_U32_LOC[i] = starSet[i]; } for(i = 0; i < (BGSTARSLENGTH * 3); i++){ index0 = r() >> 25; index1 = r() >> 25; if(index0 > 16){ tile0 = 0; } else{ tile0 = index0; } if(index1 > 16){ tile1 = 0; } else{ tile1 = index1; } tile1 = (tile1 << 16); flip0 = r() >> 30; flip1 = r() >> 30; flip0 = (flip0 << 10); flip1 = (flip1 << 26); SBB16_U32_LOC[i] = (tile0 | tile1 | flip0 | flip1); } while(1){ vBlankBool_A = (DISPSTAT & VBLANKFLAG); if(vBlankBool_A & ~vBlankBool_B){ keyPoll(); if(keyDown(BUTTON_DOWN)){ starYoff++; } if(keyDown(BUTTON_UP)){ starYoff--; } if(keyDown(BUTTON_LEFT)){ starXoff -= 2; } if(keyDown(BUTTON_RIGHT)){ starXoff += 2; } starXoff += 3; BG1HOFS = starXoff >> 1; BG2HOFS = starXoff >> 2; BG3HOFS = starXoff >> 3; BG1VOFS = starYoff; BG2VOFS = starYoff >> 1; BG3VOFS = starYoff >> 2; } vBlankBool_B = vBlankBool_A; } } void interruptHandler(void){ if(INTERRUPTF & INTERRUPT_TM1){ tm1Interrupt(); } } void tm1Interrupt(void){ TM0CNT = 0; DMA1CNT = 0; INTERRUPTF = INTERRUPT_TM1; } void displayText(u32 length, const char string[], u32 colorIndex){ u32 i; for(i = 0; i < length; i++){ SBB31LOC[i] = (string[i] - 32); } } void playSound(u32 frequency, const u32* loc, u32 length){ TM0CNTCOUNT = 65536 - (16777216 / frequency); TM1CNTCOUNT = 65536 - length; TM1CNT = (TIMER_COUNTUPTIMING | TIMER_IRQENABLE); DMA1SAD = (u32)loc; DMA1DAD = (u32)FIFOA; SOUNDCNT_H = SOUNDCNT_H | SOUND_HARESETFIFO; DMA1CNT = (DMASTARTTIMING_SPEC | DMAENABLE | DMAREPEAT | DMATRANSFER_32); TM0CNT = TIMER_START; TM1CNT = TM1CNT | TIMER_START; } |
I am not really sure what to include so if anything isn't clear please ask.[/code]
_________________
French re f draft free e w shredder for c rt