Message-ID: From: Shawn Hargreaves To: djgpp AT delorie DOT com Subject: Re: Allegro Timers Date: Wed, 15 Dec 1999 12:10:08 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Reply-To: djgpp AT delorie DOT com Alex Mendes da Costa writes: > Can someone please explain to me how Allegro uses multiple timers > while at the same time keeping to BIOS timer going right? > If you have one timer at 18.2 times a second and another at 100 > times a sec how does Allegro call them both accurately? A mixture of magic and some careful juggling :-) The ideal way is to keep rescheduling the hardware timer to generate interrupts whenever any of the various callbacks is due to fire, and then figure out which routines to run from inside that IRQ handler. This is extremely accurate, but requires precise control over the timer chip, which isn't possible under win95. So there is an alternative mode for systems that can't support the accurate version, where the timer is just run at a constant faster rate (usually 1/200 of a second), and then figures out which other callback to trigger so that they all go at more or less the right speeds. For details, see src/timer.c and src/dos/dtimer.c (assuming you have a recent WIP version). Shawn Hargreaves.