summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/pit8253.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/pit8253.cpp')
-rw-r--r--src/devices/machine/pit8253.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/devices/machine/pit8253.cpp b/src/devices/machine/pit8253.cpp
index 1cfb5d45c3e..87f669b2b3e 100644
--- a/src/devices/machine/pit8253.cpp
+++ b/src/devices/machine/pit8253.cpp
@@ -724,7 +724,7 @@ void pit8253_device::update(pit8253_timer *timer)
attotime elapsed_time = now - timer->last_updated;
int64_t elapsed_cycles = elapsed_time.as_double() * timer->clockin;
- LOG1(("update(): timer %d, %d elapsed_cycles\n", timer->index, elapsed_cycles));
+ LOG2(("update(): timer %d, %d elapsed_cycles\n", timer->index, elapsed_cycles));
if (timer->clockin)
timer->last_updated += elapsed_cycles * attotime::from_hz(timer->clockin);
@@ -809,7 +809,15 @@ READ8_MEMBER( pit8253_device::read )
case 3:
/* read bits 0-7 first, then 8-15 */
- data = (value >> (timer->rmsb ? 8 : 0)) & 0xff;
+
+ // reading back the current count while in the middle of a
+ // 16-bit write returns a xor'ed version of the value written
+ // (apricot diagnostic timer test tests this)
+ if (timer->wmsb)
+ data = ~timer->lowcount;
+ else
+ data = value >> (timer->rmsb ? 8 : 0);
+
timer->rmsb = 1 - timer->rmsb;
break;
}