Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!uunet!zephyr.ens.tek.com!tektronix!sequent!norsk From: norsk@sequent.UUCP (Doug Thompson) Newsgroups: comp.sys.ibm.pc Subject: Re: .84 usec Timer resolution on PC Message-ID: <25344@sequent.UUCP> Date: 22 Nov 89 22:34:46 GMT References: <25235@sequent.UUCP> <1757@crdos1.crd.ge.COM> Reply-To: norsk@crg2.UUCP (Doug Thompson) Distribution: usa Organization: Sequent Computer Systems, Inc. Lines: 37 In article <1757@crdos1.crd.ge.COM> davidsen@crdos1.UUCP (bill davidsen) writes: >In article <25235@sequent.UUCP> norsk@sequent.UUCP (Doug Thompson) writes: > >| To program Timer 0 to Mode 2 do the following: >| >| mov al, 34h ; Timer 0 - Mode 2 >| out 43h, al >| xor al, al ; Get ZERO to give full count of 65536 >| jmp $+2 >| out 40h, al ; load low order byte >| jmp $+2 >| out 40h, al ; hi order byte > > Could you explain the "jmp $+2" instructions? I mean, I know what they >do, but not why you're doing it. If this is supposed to be a software >delay (a) comments are nice and (b) sad experience tells me that fast >cpus will need more delay than slow cpus. > > A little clarification, please, as to the intent? Also the "jmp $+1" >in the second part? >-- Sorry if this caused some confusion. What I did was copy the "main" parts of the code from the article cited to provide everyone an idea of what I was talking about. the 'jmp $+1' obviously was a typo. It should be a jmp $+2 like the others. And they are a delay tactic to flush the instruction queue of the chip so that the IO devices have a chance to recover. Faster CPUs would have to adjust for more delay. (BTW the code I copied used a single 'nop' which provides almost no delay. And this delay tactic won't work on the 486, since jmps don't flush the queue. The 486 decodes BOTH paths of all jumps to speed up the jump when taken - sure is a good use of silicon in my opinion) -- Douglas Thompson UUCP: ..{tektronix,ogcvax,uunet}!sequent!norsk Sequent Computer Systems Phone: (503) 526-5727 15450 SW Koll Parkway !"The scientist builds to learn;the engineer learns in Beaverton OR 97006 !order to build." Fred Brooks