From cd364a9315bb86d3097e16322da3ab8004286a99 Mon Sep 17 00:00:00 2001 From: zowhoey <11893985+zowhoey@users.noreply.github.com> Date: Sun, 7 Jun 2026 21:41:40 +0100 Subject: [PATCH] gba: add bios interrupt flags (#5445) * gba: add bios interrupt flags Adds a new GBA register for interrupt flags, the register is equivalent to the IF register, but is intended for BIOS functions. Acknowledging the interrupts with this register allows us to use BIOS halt functions such as VBlankIntrWait and IntrWait, which we can use to get rid of busy loops in the GBA code. * fix formatting --------- Co-authored-by: zoey --- src/device/gba/gba.go | 3 +++ src/runtime/interrupt/interrupt_gameboyadvance.go | 1 + 2 files changed, 4 insertions(+) diff --git a/src/device/gba/gba.go b/src/device/gba/gba.go index bc580ba8f..6eba80780 100644 --- a/src/device/gba/gba.go +++ b/src/device/gba/gba.go @@ -85,6 +85,9 @@ var ( SIO = (*SIO_Type)(unsafe.Add(unsafe.Pointer(REG_BASE), uintptr(0x0134))) INTERRUPT = (*INTERRUPT_Type)(unsafe.Add(unsafe.Pointer(REG_BASE), uintptr(0x0200))) + + // BIOS interrupt flags + BIOS_IF = (*volatile.Register16)(unsafe.Pointer(uintptr(0x03007FF8))) ) // Main memory sections diff --git a/src/runtime/interrupt/interrupt_gameboyadvance.go b/src/runtime/interrupt/interrupt_gameboyadvance.go index 2224066ed..8eacc9669 100644 --- a/src/runtime/interrupt/interrupt_gameboyadvance.go +++ b/src/runtime/interrupt/interrupt_gameboyadvance.go @@ -23,6 +23,7 @@ func handleInterrupt() { for i := 0; i < 14; i++ { if flags&(1<