From e6d20ca199ec7053f8b93ab1c34966cd6ef73a23 Mon Sep 17 00:00:00 2001 From: SarahW Date: Sun, 3 Dec 2017 12:55:53 +0000 Subject: [PATCH] Fixed PIT readback command, and timing synchronisation when loading a timer. Fixes Sound Blaster detection in Lemmings 2. --- src/pit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pit.c b/src/pit.c index af493a6..fdcb6c9 100644 --- a/src/pit.c +++ b/src/pit.c @@ -88,7 +88,7 @@ static void pit_set_out(PIT *pit, int t, int out) static void pit_load(PIT *pit, int t) { int l = pit->l[t] ? pit->l[t] : 0x10000; - timer_process(); + timer_clock(); pit->newcount[t] = 0; pit->disabled[t] = 0; // pclog("pit_load: t=%i l=%x\n", t, l); @@ -343,11 +343,11 @@ void pit_write(uint16_t addr, uint8_t val, void *p) if (!(val&0x20)) { if (val & 2) - pit->rl[0] = pit->using_timer[0] ? ((int)(pit->c[0] / PITCONST) >> TIMER_SHIFT) : pit->count[0]; + pit->rl[0] = pit_read_timer(pit, 0); if (val & 4) - pit->rl[1] = pit->using_timer[1] ? ((int)(pit->c[1] / PITCONST) >> TIMER_SHIFT) : pit->count[1]; + pit->rl[1] = pit_read_timer(pit, 1); if (val & 8) - pit->rl[2] = pit->using_timer[2] ? ((int)(pit->c[2] / PITCONST) >> TIMER_SHIFT) : pit->count[2]; + pit->rl[2] = pit_read_timer(pit, 2); } if (!(val & 0x10)) {