mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user