From: Reinier Heeres Newsgroups: comp.os.msdos.djgpp Subject: Re: Keeping speed with slow CPUs Date: Fri, 06 Feb 1998 19:35:45 +0100 Organization: World Online Message-ID: <34DB5800.4898708@worldonline.nl> References: <6be66a$e7i$1 AT herald DOT Mines DOT EDU> Reply-To: rwh AT worldonline DOT nl NNTP-Posting-Host: alkmr1-p86.worldonline.nl Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 33 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Jean-Luc Romano wrote: > Hi, again. > > while (!quitflag) /* event loop */ > { > /* Event loop stuff */ > > prepare_buffer(); > regulate(); > blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); > } > > And my regulate function is: > > void regulate() /* uses the timer to make sure a min amount > of time is spent each event loop */ > { > while (timer < 100_milliseconds) /* has .1 secs passed yet? */ > { > /* Do nothing -- just wait out the timer */ > } > timer = 0; /* once done waiting, reset the timer */ > } Hi, You really should install a timer by hooking interrupt 0. It will be called 18.2 times/sec. Let your handler set a flag that it's allowed to draw a new frame... Reinier