Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!unisoft!hoptoad!pozar From: pozar@hoptoad.uucp (Tim Pozar) Newsgroups: comp.sys.ibm.pc Subject: Re: Help with delay funct for MSC Message-ID: <3419@hoptoad.uucp> Date: Mon, 30-Nov-87 02:37:13 EST Article-I.D.: hoptoad.3419 Posted: Mon Nov 30 02:37:13 1987 Date-Received: Wed, 2-Dec-87 23:12:28 EST References: <9394@shemp.UCLA.EDU> Reply-To: pozar@hoptoad.UUCP (Tim Pozar) Organization: Syncstream/Widget Systems (San Francisco) Lines: 69 Keywords: sleep function, tic, DELAY routine for MS-C In article <9394@shemp.UCLA.EDU> claus@CS.UCLA.EDU () writes: >I am writing an application in MSC 4.0, and I wish to incorporate time >delays that are independed of the speed of the machine on which the >application is run. I couldn't find any appropriate routine in the >MSC documentation (yes I do have the manual). >Something like DELAY(x), where x is 1/18 seconds, would be ideal. > >I'm sure something like this exists, can anyone help? This a sleep that will work with basicly MSC 2.0 through MSC 5.0. It is currently set up for whole seconds, but can be changed to whatever you want... Tim --- /* * get_time(n) * TIME_PTR n; * * fills timetype structure n with current time using DOS interrupt 21 * */ get_time(n) TIME_PTR n; { union REGS inregs; union REGS outregs; inregs.h.ah = GET_TIME; int86(DOS_INT, &inregs, &outregs); n->hour = outregs.h.ch; n->minute = outregs.h.cl; n->sec = outregs.h.dh; n->hsec = outregs.h.dl; return(0); } sleep(x) int x; { int i; unsigned s; TIME n; /* current time record */ i = 0; get_time(&n); s = n.sec; while (i < x){ while (s == n.sec) get_time(&n); s = n.sec; ++i; } } --- -- ======================================================================= | ...sun!hoptoad!\ Tim Pozar | | >fidogate!pozar Fido: 1:125/406 | | ...lll-winken!/ PaBell: (415) 788-3904 | | USNail: KKSF 77 Maiden Lane San Francisco CA 94108 | =======================================================================