diff options
-rw-r--r-- | src/common.h | 5 | ||||
-rw-r--r-- | src/irs.s | 6 | ||||
-rw-r--r-- | src/main.c | 6 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/common.h b/src/common.h index dac48ad..7695683 100644 --- a/src/common.h +++ b/src/common.h | |||
@@ -516,4 +516,9 @@ irq_init() { | |||
516 | IRQ_CTRL = 1; | 516 | IRQ_CTRL = 1; |
517 | } | 517 | } |
518 | 518 | ||
519 | // Stub function pointer needed for when we want to enable interrupts that don't | ||
520 | // require a custom function, such as for the BIOS VSync. | ||
521 | void | ||
522 | irq_stub() {} | ||
523 | |||
519 | #endif // GBAEXP_COMMON_H | 524 | #endif // GBAEXP_COMMON_H |
@@ -47,7 +47,9 @@ irs_main_handle_irs: | |||
47 | mov r0, #1 | 47 | mov r0, #1 |
48 | lsl r0, r0, r3 | 48 | lsl r0, r0, r3 |
49 | strh r0, [ip, #2] | 49 | strh r0, [ip, #2] |
50 | @ TODO: IRQ_ACK_BIOS | 50 | ldr r1, [ip, #-0x208] |
51 | orr r1, r1, r0 | ||
52 | str r1, [ip, #-0x208] | ||
51 | 53 | ||
52 | @ Store the SPSR in one of the free registers and save it along with the | 54 | @ Store the SPSR in one of the free registers and save it along with the |
53 | @ return pointer. | 55 | @ return pointer. |
@@ -84,5 +86,3 @@ irs_main_exit: | |||
84 | 86 | ||
85 | mem_irq_base_reg: | 87 | mem_irq_base_reg: |
86 | .word 0x04000200 @ IRQ_ENABLE | 88 | .word 0x04000200 @ IRQ_ENABLE |
87 | .word 0x04000202 @ IRQ_ACK | ||
88 | .word 0x04000208 @ IRQ_CTRL | ||
@@ -44,12 +44,12 @@ int main(void) { | |||
44 | 44 | ||
45 | // Register interrupts. | 45 | // Register interrupts. |
46 | irq_init(); | 46 | irq_init(); |
47 | irs_set(IRQ_VBLANK, irq_stub); | ||
47 | irs_set(IRQ_HBLANK, irs_hblank_func); | 48 | irs_set(IRQ_HBLANK, irs_hblank_func); |
48 | 49 | ||
49 | int frame_counter = 0; | 50 | int frame_counter = 0; |
50 | while(true) { | 51 | while(true) { |
51 | // bios_vblank_wait(); | 52 | bios_vblank_wait(); |
52 | wait_vsync(); | ||
53 | poll_keys(); | 53 | poll_keys(); |
54 | 54 | ||
55 | txt_position(0, 1); | 55 | txt_position(0, 1); |
@@ -59,7 +59,7 @@ int main(void) { | |||
59 | txt_printf(" Frame counter: %d", frame_counter); | 59 | txt_printf(" Frame counter: %d", frame_counter); |
60 | 60 | ||
61 | frame_counter++; | 61 | frame_counter++; |
62 | // update_button_sprites(); | 62 | update_button_sprites(); |
63 | }; | 63 | }; |
64 | 64 | ||
65 | return 0; | 65 | return 0; |