home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!cs.utexas.edu!torn!news.ccs.queensu.ca!dmurdoch
- From: dmurdoch@QueensU.CA (Duncan Murdoch)
- Subject: Re: how long is a clock cycle (was source for DELAY procedure)?
- Message-ID: <Bs7MvD.JF9@knot.ccs.queensu.ca>
- Sender: news@knot.ccs.queensu.ca (Netnews control)
- Organization: Queen's University, Kingston, Canada
- References: <Bs7Hv8.Bqz@news.cso.uiuc.edu>
- Date: Thu, 30 Jul 1992 16:23:37 GMT
- Lines: 35
-
- In article <Bs7Hv8.Bqz@news.cso.uiuc.edu> amead@s.psych.uiuc.edu (Alan Mead) writes:
- [ Description of Delay replacement that keeps the keyboard buffer
- flushed.]
- >
- >Also, the delay will be longer than period milliseconds by number*<the
- >time it takes to execute FlushKBD>.
- >
- >Which all seems to bear on the value of shorter. I think that the
- >BIGger I make it, the less trouble I accrue from the other points.
- >
- >And all this stuff would seem to be processor (even machine!)
- >specific. Different machines will execute FlushKBD at different
- >speeds.
- >
- >Anyone have any suggestions?
-
- Why use Delay here? If you've got a wait that's so long that someone
- could conceivably fill up the keyboard buffer, it seems likely that 55
- msec accuracy would be good enough. Just poll the system clock, and you
- can get that. This will have the advantage of working pretty well
- regardless of changes to cpu speed, or other processes in a
- multitasker.
-
- A nice Delay() replacement might use the system clock for long delays,
- and CRT.Delay for short ones.
-
- Anyone know where in the executable code
- >I can find the Delay procedure's initialization data?
-
- Trace through a call to Delay, and you'll see it referring to a constant
- in the data segment. Trace through the initialization code for the CRT
- unit (the second far call in the program "uses crt; begin end.") and
- you'll see it calibrate and set that value.
-
- Duncan Murdoch
-