From 91c78b79ef3d52bfc036bd3b160929eec94b6f51 Mon Sep 17 00:00:00 2001 From: Mark Emmer Date: Tue, 4 Mar 2014 17:39:34 -0600 Subject: [PATCH] SDS: Install better fix for 2x real-time clock speed problem Received better fix from Mark Pizzolato for the problem of having 120 clock interrupts per second instead of 60. Tested for several hours and verified that wall-clock time matches TSS monitor time. --- SDS/sds_cpu.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/SDS/sds_cpu.c b/SDS/sds_cpu.c index 382221e4..1a033a60 100644 --- a/SDS/sds_cpu.c +++ b/SDS/sds_cpu.c @@ -1582,17 +1582,14 @@ return SCPE_OK; a unit service routine and a reset routine. The service routine sets an interrupt that invokes the clock counter. The clock counter is a "one instruction interrupt", and only MIN/SKR are valid. - - Temporarily divide rtc_tps by 2 because clock is running twice as - fast as it should. Eventually have to find problem in the clock - calibration or setup code. */ t_stat rtc_svc (UNIT *uptr) { if (rtc_pie) /* set pulse intr */ int_req = int_req | INT_RTCP; -sim_activate (&rtc_unit, sim_rtcn_calb (rtc_tps/2, TMR_RTC)); /* reactivate */ +rtc_unit.wait = sim_rtcn_calb (rtc_tps, TMR_RTC); /* calibrate */ +sim_activate (&rtc_unit, rtc_unit.wait); /* reactivate */ return SCPE_OK; } @@ -1626,6 +1623,7 @@ return SCPE_OK; t_stat rtc_reset (DEVICE *dptr) { rtc_pie = 0; /* disable pulse */ +rtc_unit.wait = sim_rtcn_init (rtc_unit.wait, TMR_RTC); /* initialize clock calibration */ sim_activate (&rtc_unit, rtc_unit.wait); /* activate unit */ return SCPE_OK; }