diff --git a/src/pic.c b/src/pic.c index f83d8fcb5..43b2eee42 100644 --- a/src/pic.c +++ b/src/pic.c @@ -223,14 +223,8 @@ find_best_interrupt(pic_t *dev) static __inline void pic_update_pending_xt(void) { - 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; - } + if (!(pic.interrupt & 0x20)) + pic.int_pending = (find_best_interrupt(&pic) != -1); } /* Only check if PIC 1 frozen, because it should not happen @@ -253,13 +247,7 @@ pic_update_pending_at(void) static void 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 @@ -500,7 +488,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: