From d7bc7b302d62ffb5cde5b08fe8cb6d5ecbd5b8fb Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 28 Sep 2023 01:15:07 +0200 Subject: [PATCH] Always clear IRR on clear if the specified interrupt is not set to level-triggered on the PIC or ELCR. --- src/pic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pic.c b/src/pic.c index 83b5b785a..490468410 100644 --- a/src/pic.c +++ b/src/pic.c @@ -713,7 +713,7 @@ picint_common(uint16_t num, int level, int set, uint8_t *irq_state) if ((num >> 8) & b) { if ((!!*irq_state) != !!set) pic2.lines[i]--; - if (pic2.lines[i] == 0) + if (!pic_level_triggered(&pic2, i) || (pic2.lines[i] == 0)) lines |= ((uint16_t) b << 8); } } @@ -737,7 +737,7 @@ picint_common(uint16_t num, int level, int set, uint8_t *irq_state) if (num & b) { if ((!!*irq_state) != !!set) pic.lines[i]--; - if (pic.lines[i] == 0) + if (!pic_level_triggered(&pic, i) || (pic.lines[i] == 0)) lines |= ((uint16_t) b << 8); } }