Article View: comp.os.msdos.programmer
Article #5063Re: Generating delays
From: Peter Yeung
Date: Thu, 07 Mar 1991 05:39
Date: Thu, 07 Mar 1991 05:39
26 lines
1511 bytes
1511 bytes
In article <sg2Gwuw?@cs.psu.edu> melling@cs.psu.edu (Michael D Mellinger) writes:
>
>I need to be able to generate delays of around 1/2 second. Anyone
>have a good way of doing this? I'm using MS C 6.0. The best I can
>come up with is a 1 second delay.
>
If it does not have to be really accurate, use a loop to check the clock
counter at location 0x46c (4 bytes counter) until it advances 9 times.
This method has the accuracy of within 1/18 of a second.
A more accurate method is to write a counting loop to count how many times
does it loop when the clock counter advance from x to x+1 and use the
loop count as a timing base for a timing loop which take the same number
of cycles to loop once as the initial counting loop. Yes, this implies
intimate knowledge of the code generated by the compiler or write both
loops in assembler (can be easily done in TC).
>-Mike
--
Peter Yeung Amdahl Canada Ltd., Software Development Center
2000 Argentia Road, Plaza 2, Suite 300
Mississauga, Ont. L5N 1V8
Phone: (416) 542-6300 Fax: (416) 858-2233
Technical Details
Message-ID:
<1991Mar7.053927.12273@meadow.uucp>Path:
arc1-ca.pugleaf.net!utzoo!censor!meadow!pyReferences:
<sg2Gwuw?@cs.psu.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!utzoo!censor!meadow!py From: py@meadow.uucp (Peter Yeung) Subject: Re: Generating delays Message-ID: <1991Mar7.053927.12273@meadow.uucp> Reply-To: py@meadow.UUCP (Peter Yeung) Organization: Amdahl Canada Ltd., Software Development Center References: <sg2Gwuw?@cs.psu.edu> Distribution: comp Date: Thu, 7 Mar 91 05:39:27 GMT