From: Vinzent Hoefler Newsgroups: comp.os.msdos.djgpp Subject: Re: uclock() counts down? Date: Thu, 13 Feb 2003 10:11:02 -0500 Organization: JeLlyFish software Lines: 22 Message-ID: <6icg2b.kj2.ln@jellix.jlfencey.com> References: <795DD3C2E97585449DCDEEE79CCD5C22BA8C AT email2k DOT compuweigh DOT com> NNTP-Posting-Host: firewall.mdc-dayton.com (12.161.103.180) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1045149155 47030461 12.161.103.180 (16 [175126]) X-Orig-Path: jellix.jlfencey.com!nobody X-Newsreader: KCNews v0.19b (CAOS 4.1) X-Phone: +1-937-271-7158 X-Homepage: http://jlfencey.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Alex O wrote: > uclock(); > .. > inportb(0x40); > > which causes this odd behavior. If reading from the port 0x40 > (system's timer register) is commented out or placed before the > uclock(), everything works OK. Yes, most probably you are confusing the reading of the 8254 timer chip. You only read one byte of a 16-bit value, so the next time someone (uclock()) is reading it it will get the bytes in reversed order. Reading both bytes and making sure, interrupts are disabled during that time should do the trick. Vinzent. -- Cunnilingus is next to godliness.