void on_irq() { if(REG_IF & IRQ_VBLANK) { // DrawFrame(); if(choosingfile) { // if(choosingfile == 1) // } else { //iprintf("I AM ABOUT TO CALL EMULATEFRAME THIS IS SO EXCITING\n"); // EmulateFrame(); // EmulateSound(); DrawFrame(); } // Tell the DS we handled the VBLANK interrupt VBLANK_INTR_WAIT_FLAGS |= IRQ_VBLANK; REG_IF |= IRQ_VBLANK; } else if(REG_IF & IRQ_TIMER0) { processtimer(); VBLANK_INTR_WAIT_FLAGS |= IRQ_TIMER0; } else { // Ignore all other interrupts REG_IF = REG_IF; } } void InitInterruptHandler() { // Setup a 100Hz = 10ms timer TIMER0_DATA = TIMER_FREQ_1024(100); TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1024 | TIMER_IRQ_REQ; REG_IME = 0; IRQ_HANDLER = on_irq; REG_IE = IRQ_VBLANK | IRQ_TIMER0; REG_IF = ~0; DISP_SR = DISP_VBLANK_IRQ; REG_IME = 1; }