delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/04/05:46:58

Message-ID: <8D53104ECD0CD211AF4000A0C9D60AE30136620B@probe-2.acclaim-euro.net>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Simple timer question...
Date: Tue, 4 May 1999 10:46:50 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.0.1460.8)
Reply-To: djgpp AT delorie DOT com

SIowTalker writes:
> unsigned long QueryTimer(void)
> {
>   unsigned long clock = _farpeekl(_dos_ds, 0x0046C);
>   return(clock);
> }
>
> then so each game loop takes at least 100 milliseconds, you save 
> the time setting in the beggining of the game loop.

A nice theory, but the default BIOS timer only increments 18.2 times
a second, which is nowhere near enough to give a smooth animation
in a computer game. For more accurate timing you must use something
like the djgpp uclock() routine, or reprogram the timer interrupt
to run at a faster rate (in which case you have to deal with some
black magic to hook the interrupt and then make sure that you go
on calling the original BIOS handler at 18.2 ticks per second).


	Shawn Hargreaves.

- Raw text -


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