jibby/runtime/vblank

Here's a basic V-blank routine. All it does is simply update the sprite RAM and set the "vblank acknowledged" flag.

If you want to roll your own V-blank routine, you don't need to import this module. Instead:

from jibby/utils/codegen import isr, hramByte # isr  pragmas

var vblankAcked {.importc, hramByte, noinit.}: bool

proc Vblank*(): void {.exportc: "vblank", isr.} =
  vblankAcked = true
  # your routine hereā€¦

Or, in ASM (If you do this, make sure you {.compile.} it somewhere):

_vblank::
    push af
    ld a, 1
    ldh [hVBlankAcknowledged], a
    pop af
    reti

vblankAcked (or hVBlankAcknowledged) will be used by vram: waitFrame. As halt will stop on any interrupt, and vram: waitFrame specifically wants the V-blank interrupt, you should set this variable here. Otherwise, vram: waitFrame will keep waiting forever.