home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / INSTALL2.TD0 / SOURCES.LIF / TIME.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-09-27  |  2.0 KB  |  71 lines

  1. /*=============================================================================
  2.  
  3.      The INSTALL program source code, object code, sample  script files,
  4.      executable  program,  and  documentation  are  subject to copyright
  5.      protection under the laws of the United States and other countries.
  6.  
  7.      This software is licensed, not sold, and may only be  redistributed
  8.      in  executable format and only in accordance with the provisions of
  9.      the INSTALL Source Code License Agreement.
  10.  
  11.         INSTALL is Copyright(C) 1987-1990 by Knowledge Dynamics Corp
  12.        Highway Contract 4 Box 185-H, Canyon Lake, TX (USA) 78133-3508
  13.               512-964-3994 (Voice)   512-964-3958 (24-hr FAX)
  14.  
  15.                       All rights reserved worldwide.
  16.  
  17. ===============================================================================
  18.  
  19. FILENAME:
  20.     time.c
  21.  
  22. AUTHOR:
  23.     eric jon heflin
  24.  
  25. PUBLIC FUNCTIONS:
  26.     time_delay() - delay specified number of clock ticks
  27.  
  28. LOCAL FUNCTIONS:
  29.     none
  30.  
  31. DESCRIPTION:
  32.     The single function in this file time_delay() will wait until a specified
  33.     number of DOS clock ticks occur, or until a key is pressed, whichever 
  34.     comes first.  Normally, the parameter indicating the number of ticks is
  35.     a #define like _3_SEC_0 indicating to wait 3.0 seconds.
  36.  
  37.     This function is only used in banner().
  38.  
  39. REVISION HISTORY:
  40.     DATE:    AUTHOR:        DESCRIPTION OF CHANGES:
  41.     891230    ejh            initial release
  42.  
  43. ==============================================================================*/
  44.  
  45. #include <string.h>
  46. #include "install.h"
  47.  
  48. int kbhit(void);
  49.  
  50. #if defined(LATTICE)
  51. #define getime(tm) peek(0x40, 0x6c, (char *)(tm), 4)
  52. #else
  53. #define getime(tm) memmove(((void *)(tm)), (void *)(0x40006clU), 4)
  54. #endif  /* !LATTICE */
  55.  
  56. /* ticks = 1/18.2 seconds to wait */
  57.  
  58. void time_delay(word ticks)
  59.     {                    /* time_delay */
  60.     ulong now;    /* quiet lint */
  61.     ulong quit = (ulong) ticks;
  62.     getime(&now);
  63.     quit += now;
  64.     while (now < quit && !kbhit())
  65.         getime(&now);
  66.     if (kbhit() && sgetch() == 0)
  67.         sgetch();
  68.     }                    /* time_delay */
  69.  
  70. /* end-of-file */
  71.