jibby/utils/interrupts

Tools for dealing with interrupts.

Types

InterruptModes = enum
  IntVblank = 0, IntLcd, IntTimer, IntSerial, IntJoypad

Consts

InterruptEnable: ptr InterruptFlags = 0xFFFF'u16
rIE
InterruptFlag: ptr InterruptFlags = 0xFF0F'u16
rIF

Templates

template disableInterrupts(which: InterruptFlags)
Disable a set of Game Boy interrupts.

Example: cmd: --compileOnly -r:off

import jibby/utils/interrupts

disableInterrupts({IntVblank})
template enableInterrupts(which: InterruptFlags)
Enable a set of Game Boy interrupts.

Example: cmd: --compileOnly -r:off

import jibby/utils/interrupts

enableInterrupts({IntVblank, IntLcd})
template turnOffInterrupts()
Injects the di instruction.
Warning: Since this is inline assembly, you must use this inside of a proc.
template turnOnInterrupts()
Injects the ei instruction.
Warning: Since this is inline assembly, you must use this inside of a proc.
template waitInterrupt(): void
Injects a halt (and a nop) instruction.