Fixed PIT readback command, and timing synchronisation when loading a timer. Fixes Sound Blaster detection in Lemmings 2.

This commit is contained in:
SarahW 2017-12-03 12:55:53 +00:00
commit e6d20ca199

View file

@ -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))
{