HAM Documentation

Home · Downloads · Your Account · Submit News

Documentation Homepage HAMLib reference Back to HAM Homepage |

# Interrupt Service Functions

## Functions

void | ham_StartIntHandler (u8 intno, void *fp)
| Define an interruption event and a function to jump to on the event.
void | ham_StopIntHandler (u8 intno)
| Stop a previously started interrupt.

## Detailed Description

This section is all about Interrupts in HAM. Interrupts are very handy hardware functions that can break the execution of a program at some point in time and service a function of your choice. After completing, it returns to the execution of the normal program again, just like nothing happened.

This is very useful for synchronizing graphics updates as well as sound/controllers, and extensively used on the GBA

## Function Documentation

void ham_StartIntHandler | ( | u8 | intno,
|  | void * | fp
| ) |

Define an interruption event and a function to jump to on the event.

Parameters:

  intno | the interrupt number we want to initialize, see description
  fp | a pointer to the function that should be invoked when the interrupt is due. If you are unsure, this is usually the adress of the function, written like this: &functionname. In C++, you might need to cast your function pointer like this for the assignment to work: (void*) &functionname

This function enables an interrupt. You tell HAMlib which interrupt you would like to start, and what function should be executed when this interrupt is reached. The following interrupts are available:

- INT_TYPE_VBL (invoked when scanline passes line 160)
- INT_TYPE_HBL (invoked every scanline, when x passes 240)
- INT_TYPE_VCNT (when the current scanline matches the VCNT setting, see mygba.h )
- INT_TYPE_TIM0 (when Timer0 is due, see mygba.h)
- INT_TYPE_TIM1 (when Timer1 is due, see mygba.h)
- INT_TYPE_TIM2 (when Timer2 is due, see mygba.h)
- INT_TYPE_TIM3 (when Timer3 is due, see mygba.h)
- INT_TYPE_SIO (when Serial IO is encountered, see mygba.h)
- INT_TYPE_DMA0 (when DMA0 is finished, see mygba.h)
- INT_TYPE_DMA1 (when DMA1 is finished, see mygba.h)
- INT_TYPE_DMA2 (when DMA2 is finished, see mygba.h)
- INT_TYPE_DMA3 (when DMA3 is finished, see mygba.h)
- INT_TYPE_KEY (when a key is pressed (?) )
- INT_TYPE_CART (when the cartridge is inserted or removed, see mygba.h)

void ham_StopIntHandler | ( | u8 | intno | ) |

Stop a previously started interrupt.

Parameters:

  intno | the interrupt number we want to deinitialize, see description

This function disables a previously started interrupt. The following interrupts are available:

- INT_TYPE_VBL (invoked when scanline passes line 160)
- INT_TYPE_HBL (invoked every scanline, when x passes 240)
- INT_TYPE_VCNT (when the current scanline matches the VCNT setting, see mygba.h )
- INT_TYPE_TIM0 (when Timer0 is due, see mygba.h)
- INT_TYPE_TIM1 (when Timer1 is due, see mygba.h)
- INT_TYPE_TIM2 (when Timer2 is due, see mygba.h)
- INT_TYPE_TIM3 (when Timer3 is due, see mygba.h)
- INT_TYPE_SIO (when Serial IO is encountered, see mygba.h)
- INT_TYPE_DMA0 (when DMA0 is finished, see mygba.h)
- INT_TYPE_DMA1 (when DMA0 is finished, see mygba.h)
- INT_TYPE_DMA2 (when DMA0 is finished, see mygba.h)
- INT_TYPE_DMA3 (when DMA0 is finished, see mygba.h)
- INT_TYPE_KEY (when a key is pressed (?) )
- INT_TYPE_CART (when the cartridge is inserted or removed, see mygba.h)

Documentation Homepage | HAMLib reference | Back to HAM Homepage
documentation created with Doxygen