home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / libsrc / c / dos / delay.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  355 b   |  21 lines

  1. #include <dos.h>
  2.  
  3. void
  4. delay(unsigned msec)
  5. {
  6.   union REGS r;
  7.   while (msec)
  8.   {
  9.     int usec;
  10.     int msec_this = msec;
  11.     if (msec_this > 4000)
  12.       msec_this = 4000;
  13.     usec = msec_this * 1000;
  14.     r.h.ah = 0x86;
  15.     r.x.cx = (usec>>16) & 0xffff;
  16.     r.x.dx = usec & 0xffff;
  17.     int86(0x15, &r, &r);
  18.     msec -= msec_this;
  19.   }
  20. }
  21.