home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / pascal / 4620 < prev    next >
Encoding:
Text File  |  1992-07-30  |  1.9 KB  |  47 lines

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