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: