summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-04-28 20:06:51 +0200
committerBad Diode <bd@badd10de.dev>2021-04-28 20:06:51 +0200
commit3beb8ab1693b8ecd2b34047fde915137feb57e22 (patch)
treec5094851ae2fd9a2ff5595e014912e12a32be0da
parentdbb61a0a339306be380ff4b3bffad64b7e474d24 (diff)
downloadgba-experiments-3beb8ab1693b8ecd2b34047fde915137feb57e22.tar.gz
gba-experiments-3beb8ab1693b8ecd2b34047fde915137feb57e22.zip
Update master interrupt handler
-rw-r--r--src/irs.s9
-rw-r--r--src/main.c10
2 files changed, 12 insertions, 7 deletions
diff --git a/src/irs.s b/src/irs.s
index 66ac0c2..5cccb6e 100644
--- a/src/irs.s
+++ b/src/irs.s
@@ -17,7 +17,7 @@ irs_main:
17 17
18 @ r0 = irs_table address pointer 18 @ r0 = irs_table address pointer
19 @ r2 = tmp 19 @ r2 = tmp
20 @ r3 = 0 (for r3; r3 < 14; r3++) 20 @ r3 = 0 (for r3; r3 < 14; r3++)
21 ldr r0, = irs_table 21 ldr r0, = irs_table
22irs_main_fp_search: 22irs_main_fp_search:
23 @ Check that the current index is an active IRQ. 23 @ Check that the current index is an active IRQ.
@@ -47,9 +47,8 @@ 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 ldr r1, [ip, #-0x208] 50 ldr r1, mem_irq_ack_bios @ r1 = IRQ_ACK_BIOS
51 orr r1, r1, r0 51 str r0, [r1]
52 str r1, [ip, #-0x208]
53 52
54 @ Store the SPSR in one of the free registers and save it along with the 53 @ Store the SPSR in one of the free registers and save it along with the
55 @ return pointer. 54 @ return pointer.
@@ -86,3 +85,5 @@ irs_main_exit:
86 85
87mem_irq_base_reg: 86mem_irq_base_reg:
88 .word 0x04000200 @ IRQ_ENABLE 87 .word 0x04000200 @ IRQ_ENABLE
88mem_irq_ack_bios:
89 .word 0x03007FF8 @ IRQ_ACK_BIOS
diff --git a/src/main.c b/src/main.c
index 2f1c522..ec2150a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,9 +24,13 @@ int hblank_counter = 0;
24 24
25void 25void
26irs_hblank_func() { 26irs_hblank_func() {
27 u16 clr = (DISP_VCOUNT / 8);
28 PAL_BUFFER_BG[0] = rgb15(clr, 0, 31 - clr);
29 hblank_counter++; 27 hblank_counter++;
28 if (DISP_VCOUNT >= 160) {
29 PAL_BUFFER_BG[0] = rgb15(0, 0, 0);
30 } else {
31 u16 clr = (DISP_VCOUNT / 8);
32 PAL_BUFFER_BG[0] = rgb15(clr, 0, 31 - clr);
33 }
30} 34}
31 35
32int main(void) { 36int main(void) {
@@ -56,7 +60,7 @@ int main(void) {
56 txt_clear_line(); 60 txt_clear_line();
57 txt_printf(" HBlank counter: %d\n", hblank_counter); 61 txt_printf(" HBlank counter: %d\n", hblank_counter);
58 txt_clear_line(); 62 txt_clear_line();
59 txt_printf(" Frame counter: %d", frame_counter); 63 txt_printf(" Frame counter: %d\n", frame_counter);
60 64
61 frame_counter++; 65 frame_counter++;
62 update_button_sprites(); 66 update_button_sprites();