From 6602a323049a017421065d4d7e55bf9d1fbef8db Mon Sep 17 00:00:00 2001 From: TomW Date: Sat, 10 Oct 2015 14:32:50 +0100 Subject: [PATCH] Reverted rev 339. Fixes Adlib Gold jukebox. Disable PIT timer operation between write of control word and initial count. Lemmings High Performance PC mode now works without incorrect rev 339 commit. --- src/ibm.h | 1 + src/pic.c | 2 -- src/pit.c | 17 ++++++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) 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;