z80ctc: Fixed Z80CTC read handler [Tim Schuerewegen]

side note: given that at write (lines 339-342) the timer is adjusted with (tconst * period) it seems reasonable that at read we divide by period rather than multiplying.
This commit is contained in:
Fabio Priuli 2010-02-17 09:28:52 +00:00
parent 0771a0123a
commit 3a53e7d5dd

View File

@ -302,7 +302,7 @@ READ8_DEVICE_HANDLER( z80ctc_r )
VPRINTF(("CTC clock %f\n",ATTOSECONDS_TO_HZ(period.attoseconds)));
if (channel->timer != NULL)
return ((int)(attotime_to_double(timer_timeleft(channel->timer)) * attotime_to_double(period)) + 1) & 0xff;
return ((int)(attotime_to_double(timer_timeleft(channel->timer)) / attotime_to_double(period)) + 1) & 0xff;
else
return 0;
}