#46806 - paladine - Fri Jul 01, 2005 12:42 am
My interrupts are working just fine and dandy in VBA but when I load my image to the real hardware it never gets called at all! I'm using a plain makefile setup with Jeff's crtls, crt0.s 1.28 and lnkscript 1.3.
Here's some sample code
and the setup code
Judging from the code it should make the screen quickly go from white to black. But no interrupts fire so nothing happens, just stays frozen.
Here's some sample code
Code: |
CODE_IN_IWRAM void InterruptProcess() { u16 intFlag = REG_IF; /* turn off interrupts */ REG_IME = 0; static int i=0; if ((i++) & 1) { static u16 full = 0x7FFF; DMACopy(&full,VIDEO_BUFFER,38400,DMA_16NOW | DMA_SOURCE_FIXED); } else { static u16 empty = 0; DMACopy(&empty,VIDEO_BUFFER,38400,DMA_16NOW | DMA_SOURCE_FIXED); } /* service interrupt */ if ((intFlag & INT_VBLANK)) { /* perform the DMA transfers */ /*while (!list_empty(&dmaList)) { LPDMATRANSFER pDMA = (LPDMATRANSFER)list_pop(&dmaList); // perform transfer REG_DMA0SAD = (u32)(pDMA->src); REG_DMA0DAD = (u32)(pDMA->dest); REG_DMA0CNT = pDMA->flags; // remove from list list_del(&pDMA->list); } */ /* update sprites */ SpriteCopyToOAM(); } REG_IF |= intFlag; SWI_ACKNOWLEDGE |= intFlag; /* turn them back on */ REG_IME = 1; } |
and the setup code
Code: |
/* no interrupts quite yet */ REG_IME = 0; REG_DISPCNT = (3 | BG2_ENABLE | OBJ_ENABLE | OBJ_MAP_1D); /* turn on vblank interrupts */ REG_IE |= INT_VBLANK | INT_HBLANK; REG_DISPSTAT |= REG_DISPSTAT_ENABLE_VBLANK | REG_DISPSTAT_ENABLE_HBLANK; /* turn on timers */ REG_TM0CNT = TIMER_FREQUENCY_1024 | TIMER_ENABLE; REG_TM1CNT = TIMER_OVERFLOW | TIMER_ENABLE; /* turn off backgrounds */ REG_BG0CNT = 0; REG_BG1CNT = 0; REG_BG2CNT = 0; REG_BG3CNT = 0; // turn off blending REG_BLDMOD = 0; /* turn interrupts on */ REG_IME = 1; |
Judging from the code it should make the screen quickly go from white to black. But no interrupts fire so nothing happens, just stays frozen.