diff options
Diffstat (limited to 'src/gba')
-rw-r--r-- | src/gba/gba.h | 8 | ||||
-rw-r--r-- | src/gba/interrupts.s | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/gba/gba.h b/src/gba/gba.h index 3f629fd..1bb3afd 100644 --- a/src/gba/gba.h +++ b/src/gba/gba.h | |||
@@ -534,6 +534,14 @@ void irs_set(IrqIndex idx, IrsFunc func); | |||
534 | // assembly and enable interrupts. | 534 | // assembly and enable interrupts. |
535 | void irq_init(void); | 535 | void irq_init(void); |
536 | 536 | ||
537 | // Only should be used inside an IrsFunc to enable it being interrupted by the | ||
538 | // given interrupt (nested IRS). | ||
539 | static inline void | ||
540 | irs_interruptible(IrqIndex idx) { | ||
541 | IRQ_ENABLE |= (1 << idx); | ||
542 | IRQ_CTRL = 1; | ||
543 | } | ||
544 | |||
537 | // | 545 | // |
538 | // BIOS function declarations. | 546 | // BIOS function declarations. |
539 | // | 547 | // |
diff --git a/src/gba/interrupts.s b/src/gba/interrupts.s index 67b9fe9..1d3e001 100644 --- a/src/gba/interrupts.s +++ b/src/gba/interrupts.s | |||
@@ -67,6 +67,10 @@ irs_main_handle_irs: | |||
67 | bx r2 | 67 | bx r2 |
68 | ldmfd sp!, {lr} | 68 | ldmfd sp!, {lr} |
69 | 69 | ||
70 | @ Clear IRQ enable again just in case it was enabled from within the IRS. | ||
71 | mov r3, #0 @ r3 = 0 | ||
72 | strh r3, [ip, #8] @ *(ip + 0x8) = r3 | ||
73 | |||
70 | @ Set CPU to irq mode | 74 | @ Set CPU to irq mode |
71 | mrs r3, cpsr | 75 | mrs r3, cpsr |
72 | bic r3, r3, #0xDF | 76 | bic r3, r3, #0xDF |