From b4aea2f7689c9b50901f51912392f2791567c522 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 8 Aug 2023 03:52:09 +0200 Subject: [PATCH] The PIC timer is no longer used to latch all IRQ updates on XT, but only those after writes to the mask register, which are now delayed for the duration of 1 CPU cycles, making the PCjr boot again, fixes #3500. --- src/pic.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/pic.c b/src/pic.c index 09ccf5d03..cb4cc109e 100644 --- a/src/pic.c +++ b/src/pic.c @@ -225,12 +225,7 @@ 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; + pic.int_pending = (find_best_interrupt(&pic) != -1); } static __inline void @@ -248,11 +243,7 @@ pic_callback(void *priv) { pic_t *dev = (pic_t *) priv; - dev->int_pending = 1; - - latched--; - if (latched > 0) - timer_on_auto(&pic_timer, 0.35); + update_pending(); } void @@ -501,7 +492,10 @@ pic_write(uint16_t addr, uint8_t val, void *priv) break; case STATE_NONE: dev->imr = val; - update_pending(); + if (is286) + update_pending(); + else + timer_on_auto(&pic_timer, .0 * ((10000000.0 * (double) xt_cpu_multi) / (double) cpu_s->rspeed)); break; default: