#8304 - Lupin - Mon Jul 07, 2003 9:37 pm
I have problems getting the vblank interrupt work in mode5, but maybe it's just my odd interrupt handling wich already caused some other problems...
Here is the basic interrupt stuff I'm doing:
In my main() I'm just doing this:
I'm not doing any interrupt stuff within my crt0.o files, so the problem has to be within the lines I posted above or mode 5 simply doesn't have an VBLANK interrupt (wich would be kinda odd...)
Here is the basic interrupt stuff I'm doing:
Code: |
typedef void (*interrupt_handler_t)(); typedef interrupt_handler_t *interrupt_handler_ptr_t; #define REG_IME (*(vu16*)0x4000208) #define REG_IE (*(vu16*)0x4000200) #define REG_IF (*(vu16*)0x4000202) #define REG_INTERUPT (*((interrupt_handler_ptr_t)0x03007FFC)) void HandleInterrupt() { switch (REG_IF) { case INT_VBLANK: VBLANK(); REG_IF = INT_VBLANK; case INT_KEYBOARD: KEYBOARD(); REG_IF = INT_KEYBOARD; } } void EnableInterrupts(u16 interrupts) { REG_IME = 0; if(interrupts | INT_VBLANK) REG_DISP_STAT |= 0x8; if(interrupts | INT_HBLANK) REG_DISP_STAT |= 0x10; if(interrupts | INT_KEYBOARD) REG_P1CNT |= BIT14 | BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | BIT6 | BIT7 | BIT8 | BIT9; REG_IE |= interrupts; REG_IME = 1; } |
In my main() I'm just doing this:
Code: |
REG_INTERUPT = HandleInterrupt; EnableInterrupts(INT_VBLANK); |
I'm not doing any interrupt stuff within my crt0.o files, so the problem has to be within the lines I posted above or mode 5 simply doesn't have an VBLANK interrupt (wich would be kinda odd...)