From 3beb8ab1693b8ecd2b34047fde915137feb57e22 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Wed, 28 Apr 2021 20:06:51 +0200 Subject: Update master interrupt handler --- src/irs.s | 9 +++++---- src/main.c | 10 +++++++--- 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: @ r0 = irs_table address pointer @ r2 = tmp - @ r3 = 0 (for r3; r3 < 14; r3++) + @ r3 = 0 (for r3; r3 < 14; r3++) ldr r0, = irs_table irs_main_fp_search: @ Check that the current index is an active IRQ. @@ -47,9 +47,8 @@ irs_main_handle_irs: mov r0, #1 lsl r0, r0, r3 strh r0, [ip, #2] - ldr r1, [ip, #-0x208] - orr r1, r1, r0 - str r1, [ip, #-0x208] + ldr r1, mem_irq_ack_bios @ r1 = IRQ_ACK_BIOS + str r0, [r1] @ Store the SPSR in one of the free registers and save it along with the @ return pointer. @@ -86,3 +85,5 @@ irs_main_exit: mem_irq_base_reg: .word 0x04000200 @ IRQ_ENABLE +mem_irq_ack_bios: + .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; void irs_hblank_func() { - u16 clr = (DISP_VCOUNT / 8); - PAL_BUFFER_BG[0] = rgb15(clr, 0, 31 - clr); hblank_counter++; + if (DISP_VCOUNT >= 160) { + PAL_BUFFER_BG[0] = rgb15(0, 0, 0); + } else { + u16 clr = (DISP_VCOUNT / 8); + PAL_BUFFER_BG[0] = rgb15(clr, 0, 31 - clr); + } } int main(void) { @@ -56,7 +60,7 @@ int main(void) { txt_clear_line(); txt_printf(" HBlank counter: %d\n", hblank_counter); txt_clear_line(); - txt_printf(" Frame counter: %d", frame_counter); + txt_printf(" Frame counter: %d\n", frame_counter); frame_counter++; update_button_sprites(); -- cgit v1.2.1