Mail Archives: djgpp/2007/01/09/04:02:48
<Gordon DOT Schumacher AT seagate DOT com> wrote in message
news:OF1B107D53 DOT 1922E890-ON8725725D DOT 005F267B-8725725D DOT 00633021 AT seagate DOT com...
> I was indeed talking about the 18.2 per second timer - which appears to be
> the one that DOS is using internally. So that staleness of the hundredths
> field is already an issue just using the CMOS. Here's a snippet of
> documentation on this: http://www.merlyn.demon.co.uk/prog2000.htm#MSF
> I've also dug through the FreeDOS source code and confirmed that this is
> how FD behaves.
Interesting... Thanks for that. Looks like some more good info there too.
> Use the following for proof:
>
> #include <stdio.h>
> #include <time.h>
>
> int main()
> {
> int i;
> for (i = 0; i < 400; i++) {
> uclock_t start;
> struct timeval tp;
>
> gettimeofday(&tp, NULL);
> printf("%ld\t", tp.tv_usec);
> // Uncomment if your machine is too fast...
> // start = uclock();
> // while (uclock() < start + UCLOCKS_PER_SEC / 500);
> }
> printf("\n");
> return 0;
> }
>
I'm sure I'll get around to trying it eventually. Seems like I have some
need for everything six months or so later... :-)
> The clock frequency should be (1.193*10^6) / 65536 Hz, which works out to
> 18.203 or so. I'm modifying my code to use the more accurate calculation
> starting with the crystal frequency instead of CLOCKS_PER_SEC (it means
> doing floating-point math but it's still so much faster than the original
> that it's still worth it).
I believe this it the math you'll need:
14.318Mhz=4*3.58Mhz=4*(4.5Mhz*455/572)
(4.5Mhz US TV bandwith/channel, 455 colorburst phase changes/line, 572
total lines/frame including sync)
14.318Mhz/12=1.93182Mhz
1.93182Mhz/65536=18.2065Hz
> # I had hoped someone much more familiar with the issues you bring up
would
> # respond to you first...
>
> No worries. I've also posted some actual code over on DJGPP-Workers,
> since this didn't seem like the appropriate place for it... I'll link
> to it though:
>
http://www.delorie.com/djgpp/mail-archives/browse.cgi?p=djgpp-workers/2007/01/05/17:36:42
>
Yes, thanks for that too. I usually only look at mail archives if GMANE
NNTP-izes it.
Rod Pemberton
- Raw text -