delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/23/10:17:38

Message-Id: <335E1793.7CB1@canvaslink.com>
Date: Wed, 23 Apr 1997 10:07:15 -0400
From: Tom Grandgent <tgrand AT canvaslink DOT com>
Reply-To: tgrand AT canvaslink DOT com
Organization: Canvas Link, Inc.
Mime-Version: 1.0
To: kuku AT gilberto DOT physik DOT rwth-aachen DOT de
Cc: djgpp AT delorie DOT com
Subject: Re: timer interrupt - sample code anyone?

> I need a (relatively fine grained) time base and I'm thinking of using
> the system timer chip for this purpose. Never programmed that chip 
> before and never dealt with hardware interrupts under djgpp.
>
> Can anyone point me to some sample code?

You should seek out the Allegro game programming library.  It has
a very nice system of timing functions that's easy to use, plus it
includes the source if you want to see how it's done.  I've been using
its timing system for a game I'm writing and it's worked very well-
I have 4 different timers all running at different speeds.  Allegro
actually dynamically reprograms the system timer chip or something..

> The timer should interrupt at a rate of 10 KHz and the interrupt
> service routine is just supposed to increment a global 32 bit value.
>
> Hope, the 10KHz doesn't bring down the overall system performance.
>
> --
> Chris Christoph P. U. Kukulies kuku AT gil DOT physik DOT rwth-aachen DOT de

Wow..  I was just experimenting with that last night.  I needed
to measure the number of milliseconds per frame of my game, so
I made a 1KHz timer.  It wasn't quite enough, so I tried making a
10KHz timer.  (Both of these incremented a global 32 bit value.)
The 1KHz timer had no apparent effect on the game, but the 10KHz
timer knocked the framerate down from around 72Hz to about 68-69Hz.
(This was under Win95 though...)

Hope this helps,

	Tom Grandgent
	tgrand AT canvaslink DOT com
	Canvas Link, Inc.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019