NESHLA: Reference: Preprocessor Keywords:
 Interrupt Vectors

The NES Interrupt Vectors are pointers to interrupt functions in code which gets executed upon certain events.

 Vector Declarations

 #start function

The #start directive specifies the function which the start (reset) interrupt vector should point to. When the NES is turned on or reset, this function will be executed.

Examples

#start main

interrupt main()
{
  // main code
}

 #nmi function

The #nmi directive specifies the function which the non maskable (vblank) interrupt vector should point to. When the NES' screen refresh is complete, the nmi interrupt function is executed. It is called on a 60hz basis on NTSC systems, and 50hz on PAL. It can be used for timing as well as writing to the video RAM. Writes to the video RAM during the screen refresh will usually cause serious problems with the graphics, so to write to it, you should either do it during the nmi or turn the screen off first.

Examples

#nmi vblank

interrupt vblank()
{
  // vblank code
}

 #irq function

The #irq directive specifies the function which the interrupt request vector should point to. Mappers control the IRQ, and it is generally executed upon hblank (when a scanline is complete), but can be controlled to execute on any event the mapper needs.

Examples

#irq main

interrupt irq()
{
  // irq code
}


<< Back To Index