home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!wupost!usc!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!s.psych.uiuc.edu!amead
- From: amead@s.psych.uiuc.edu (Alan Mead)
- Subject: how long is a clock cycle (was source for DELAY procedure)?
- Message-ID: <Bs7Hv8.Bqz@news.cso.uiuc.edu>
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Organization: UIUC Department of Psychology
- Date: Thu, 30 Jul 1992 14:35:30 GMT
- Lines: 41
-
- Tim C wonders who has the source for Crt.Delay. I know how it works,
- it initializes itself at start-up. Probably by running an empty loop
- for a clock tick or two. If you have a fairly long delay and a clone
- with a turbo button, try this experiment: toggle the turbo during the
- delay. Since Delay() has already initialized, it will completely
- screw it up.
-
- I want to run another process during a Delay(). I don't want people to
- overflow the BIOS keyboard buffer (it beeps then and that is bad for this
- app). I think the easiest way will do this is something like:
-
- procedure BusyDelay( period:integer );
- const shorter = 200;
- begin
- number := period DIV shorter;
- for i := 1 to number-1 do
- begin
- delay( shorter );
- FlushKBD; { this is my own procedure to flush the BIOS keyboard buffer }
- end;
- delay( period - number*shorter );
- end; { proc Busy Delay }
-
- But I see several problems. FlushKBD will, depending on how I
- implement it, take a different amount of time to execute depending on
- how many keystrokes are in the buffer.
-
- 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? Anyone know where in the executable code
- I can find the Delay procedure's initialization data?
-
- -alan mead
-