Prepare a memory (hereinafter referred to as mask storage memory) that always has the same contents as the interrupt mask register.
When writing to the interrupt mask register, be sure to write the same contents to the mask storage memory.
When reading the interrupt mask register, read the contents of the mask storage memory.
void sysInit() { INT_SetMsk((INT_MSK_HBLK_IN | INT_MSK_VBLK_OUT), (INT_MSK_SPR | INT_MSK_DMA1)); /* Enable "H-Blank-IN" and "V-Blank-OUT" */ /* Disable "End sprite drawing" and "Level 0-DMA" */ ... } void anyPrg() { Uint32 status_bit; status_bit = INT_GET_STAT(); /* Get status */ if(INT_JudgeStat(status_bit,INT_ST_VBLK_OUT,INT_ST_VBLK_IN) == TRUE){ /* V-blank-OUT interrupt occurs, */ /* When V-Blank-IN interrupt has not occurred */ ... } }
#pragma interrupt (vblkIn) /* Make the vblkIn function the interrupt function */ void vblkIn(void) { ... }
void systemInit(void) { INT_SetFunc(INT_SCU_VBLK_IN, vblkIn); /* vblkIn interrupt function V-blank-IN interrupt vector */ /* Register in the table. */ INT_SetScuFunc(INT_SCU_VBLK_OUT, vblkOut); /* vblkOut function of V-blank-OUT interrupt vector */ /* Register to SCU interrupt function. */ ... } void vblkOut(void) { ... }