Date: Thu, 6 Oct 1994 11:03:26 +0500 From: hvb AT netrix DOT com To: hvb AT netrix DOT com, flaregun AT strauss DOT udel DOT edu Subject: Re: accuracy of clock() Cc: eliz AT is DOT elta DOT co DOT il, DJGPP AT sun DOT soe DOT clarkson DOT edu, victor AT euler DOT berkeley DOT edu Reply-To: hvb AT netrix DOT com > On Wed, 5 Oct 1994 hvb AT netrix DOT com wrote: > > > > > > > > > > We had to reprogram the timer chip (8253) to have a faster interrupt rate. You > > > > still need to call the original interrupt to have the DOS clock up to date. > > > > On some hardware platform, this is not achievable as the disk drive actually > > > > uses the chip timer output for some of its own timing!!! > > > > > > AFAIK the timer chip has 3 independent timers/counters, each of which > > > can be programmed individually. The first 2 are used, but the third > > > isn't. So, unless those disks you mention use that third timer, it > > > can be reprogrammed without affecting system operation in any way > > > whatsoever, including the luxury to not pass the interrupts to the > > > original Int 08 handler which maintains DOS time. Am I right? > > > > > The truth is: > > > > Timer 0 is the one that DOS uses for its real time clock interrupt. I've > > read somewhere that some disk hardware uses this timer 0 output to time > > some of its internal operation, so if we reprogram this timer, on some > > hardware you may have to restore it back to its original state before > > certain disk operation. We did not need to do this on our PC based hardware. > > If we had to we probably have to work on some other solutions as it > > is not acceptable to do so. > > > > Timer 1: is used for the RAM refresh. So it is a no no. > > > > Timer 2: is used to generate sound for the speaker. This output does not > > generate any interrupt to the CPU. If you just want to sample the clock timer > > then it is ok. > > > > Anyone got docs on how to program the timers? If this is correct and > you can use timer 2 without worrying about disk drives/system stuff, then > it seems that we could make some decent use of it for DJGPP. > I used: 1. Intel Microprocessor and Peripheral Handbook, volume II-peripheral 8253/8253-5 Programmable Time Interval (some hardware uses the 8254 Programmable Time Interval) 2. Robert Jourdain, Programmer's problem solver for the IBM PC, XT & AT (I am sure any PC reference book would contain similar info). ============================================================== Hung Bui Internet: hvb AT netrix DOT com Netrix Corporation Phone: +1 703 793 1016 13595 Dulles Technology Drive Fax: +1 703 713 3805 Herndon Va 22071 ==============================================================