From b03df6bdd1ab3741220bc6b70287b12644928b9e Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 1 Oct 2023 17:26:44 +0200 Subject: [PATCH] Attempted PIC fix. --- src/pic.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/pic.c b/src/pic.c index 9f7f2cc9b..cb0e31641 100644 --- a/src/pic.c +++ b/src/pic.c @@ -223,25 +223,30 @@ find_best_interrupt(pic_t *dev) static __inline void pic_update_pending_xt(void) { - if (find_best_interrupt(&pic) != -1) { - latched++; - if (latched == 1) - timer_on_auto(&pic_timer, 0.35); - } else if (latched == 0) - pic.int_pending = 0; + if (!(pic.interrupt & 0x20)) { + if (find_best_interrupt(&pic) != -1) { + latched++; + if (latched == 1) + timer_on_auto(&pic_timer, 0.35); + } else if (latched == 0) + pic.int_pending = 0; + } } static __inline void pic_update_pending_at(void) { - pic2.int_pending = (find_best_interrupt(&pic2) != -1); + if (!(pic2.interrupt & 0x20)) { + pic2.int_pending = (find_best_interrupt(&pic2) != -1); - if (pic2.int_pending) - pic.irr |= (1 << pic2.icw3); - else - pic.irr &= ~(1 << pic2.icw3); + if (pic2.int_pending) + pic.irr |= (1 << pic2.icw3); + else + pic.irr &= ~(1 << pic2.icw3); + } - pic.int_pending = (find_best_interrupt(&pic) != -1); + if (!(pic.interrupt & 0x20)) + pic.int_pending = (find_best_interrupt(&pic) != -1); } static void @@ -755,8 +760,7 @@ picint_common(uint16_t num, int level, int set, uint8_t *irq_state) } } - if (!(pic.interrupt & 0x20) && !(pic2.interrupt & 0x20)) - update_pending(); + update_pending(); } static uint8_t