diff --git a/src/ibm.h b/src/ibm.h index afab148..d1614b6 100644 --- a/src/ibm.h +++ b/src/ibm.h @@ -214,6 +214,7 @@ typedef struct PIT int using_timer[3]; int initial[3]; int latched[3]; + int disabled[3]; } PIT; PIT pit; diff --git a/src/pic.c b/src/pic.c index 60e92a0..483fe9b 100644 --- a/src/pic.c +++ b/src/pic.c @@ -111,13 +111,11 @@ void pic_write(uint16_t addr, uint8_t val, void *priv) if (pic.ins&(1<> TIMER_SHIFT); + if (pit.disabled[t]) + { + pit.count[t] += 0xffff; + pit.c[t] += (int)((0xffff << TIMER_SHIFT) * PITCONST); + return; + } + +// if (!t) pclog("pit_over: t=%i l=%x c=%x %i hit=%i\n", t, pit.l[t], pit.c[t], pit.c[t] >> TIMER_SHIFT, pit.thit[t]); switch (pit.m[t]) { case 0: /*Interrupt on terminal count*/ @@ -354,6 +366,9 @@ void pit_write(uint16_t addr, uint8_t val, void *priv) pit.initial[t] = 1; if (!pit.m[val >> 6]) pit_set_out(val >> 6, 0); + else + pit_set_out(val >> 6, 1); + pit.disabled[val >> 6] = 1; // pclog("ppispeakon %i\n",ppispeakon); } pit.wp=0;