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 <git@zoey.si>
This commit is contained in:
zowhoey
2026-06-07 21:41:40 +01:00
committed by GitHub
parent ca584de84a
commit cd364a9315
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -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
@@ -23,6 +23,7 @@ func handleInterrupt() {
for i := 0; i < 14; i++ {
if flags&(1<<uint(i)) != 0 {
gba.INTERRUPT.IF.Set(1 << uint(i)) // acknowledge interrupt
gba.BIOS_IF.Set(1 << uint(i)) // acknowledge interrupt for BIOS
callInterruptHandler(i)
}
}