Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3DF331EA.71F31ECF@phekda.freeserve.co.uk> Date: Sun, 08 Dec 2002 11:50:02 +0000 From: Richard Dawe X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: XP delay() again - potential solution References: <10212071847 DOT AA13093 AT clio DOT rice DOT edu> <004401c29e90$dc1ccf30$0100a8c0 AT p4> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. Andrew Cottrell wrote: [snip] > I modified the code to try the int 15 and if it failed then use the TOD tick > time as you indicated if MS fix it down the tack. I added the yields, > hopefully in the right spots and modified the txh file. I do not know what > to put in the docs so any help is appreciated even if it is I don't > understand it. So this preserves the existing behaviour of delay() on Windows 3.x, '95, '98, ME and NT. > Below are the patches, one for delay.c and the other for delay.txh. > > Any more comments on the delay.c mods? General, out of interest: Are there any good test cases for delay? I guess there's the "does it work" test, but is there anything more sophisticated? I think the patch should go in with some modifications (see my comments). [snip] > *** \djgppcvs\src\libc\dos\dos\delay.txh Mon Sep 6 22:39:32 1999 > --- .\src\libc\dos\dos\delay.txh Sun Dec 8 18:54:14 2002 > *************** > *** 13,22 **** > It uses the @code{int 15h} delay function to relinquish the CPU to other > programs that might need it. > > ! Some operating systems that emulate DOS, such as OS/2 and Windows/NT, > ! hang the DOS session when the @key{Pause} key is pressed during the call > ! to @code{delay}. Plain DOS and Windows 3.X and 9X are known to not have > ! this bug. > > @subheading Return Value > > --- 13,26 ---- > It uses the @code{int 15h} delay function to relinquish the CPU to other > programs that might need it. It doesn't describe the fact that it falls back on the TOD tick, if int 15h fails. How about adding a sentence like this? "Some operating systems, such as Windows 2000 and XP, do not support @code{int 15h}. @code{int 1ah} is used instead on these operating systems. This method has lower accuracy in the delay length." BTW the original delay code does not __dpmi_yield(). Does int 15h "relinquish the CPU"? I don't have the impression it does, from reading the description from Ralph Brown's Interrupt List. > ! Some operating systems that emulate DOS, such as OS/2, Windows/NT, Windows > 2000 > ! and Windows XP hang the DOS session when the @key{Pause} key is pressed > during > ! the call to @code{delay}. Plain DOS and Windows 3.X and 9X are known to > ! not have this bug. On Windows 2000 and XP to exit the pause press any key. > ! > ! Windows 2000 and XP delay resolution is 54.9 millisecond. Under Windows > ! 2000 and XP the delay function uses the Time Of Day Tick which occurs > ! 18.2 times per second. > > @subheading Return Value You haven't stated what the accuracy is limited to on Windows 2000 and XP. How about adding this sentence at the final paragraph? "This limits the accuracy of the delay to around 27 milliseconds on Windows 2000 and XP." The texinfo mark-up look fine to me. Thanks, bye, Rich =] -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]