diff --git a/src/386.c b/src/386.c index 6b81d79..10d6a79 100644 --- a/src/386.c +++ b/src/386.c @@ -217,12 +217,13 @@ void exec386(int cycs) int tempi; int cycdiff; int oldcyc; - int cycle_period = cycs / 2000; /*Use a 5us timing granularity*/ cycles+=cycs; // output=3; while (cycles>0) { + int cycle_period = (timer_count >> TIMER_SHIFT) + 1; + cycdiff=0; oldcyc=cycles; timer_start_period(cycles << TIMER_SHIFT); diff --git a/src/lpt_dac.c b/src/lpt_dac.c index 4daf7d2..d12f249 100644 --- a/src/lpt_dac.c +++ b/src/lpt_dac.c @@ -29,6 +29,8 @@ static void dac_update(lpt_dac_t *lpt_dac) static void dac_write_data(uint8_t val, void *p) { lpt_dac_t *lpt_dac = (lpt_dac_t *)p; + + timer_clock(); if (lpt_dac->is_stereo) { diff --git a/src/lpt_dss.c b/src/lpt_dss.c index 3e3c55e..0f53edd 100644 --- a/src/lpt_dss.c +++ b/src/lpt_dss.c @@ -29,6 +29,8 @@ static void dss_write_data(uint8_t val, void *p) { dss_t *dss = (dss_t *)p; + timer_clock(); + if ((dss->write_idx - dss->read_idx) < 16) { dss->fifo[dss->write_idx & 15] = val; diff --git a/src/timer.c b/src/timer.c index 964e19a..381562e 100644 --- a/src/timer.c +++ b/src/timer.c @@ -84,7 +84,7 @@ void timer_update_outstanding() if (*timers[c].enable && *timers[c].count < timer_latch) timer_latch = *timers[c].count; } - timer_count = timer_latch = (timer_latch + ((1 << TIMER_SHIFT) - 1)) >> TIMER_SHIFT; + timer_count = timer_latch = (timer_latch + ((1 << TIMER_SHIFT) - 1)); } void timer_reset()