delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/06/05:32:47

From: "Marp" <marp AT 0 DOT 0 DOT 0 DOT 0>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How to get bios timer tick count?
Date: Thu, 6 Apr 2000 04:20:07 -0400
Organization: MindSpring Enterprises
Lines: 74
Message-ID: <8chhg4$ms7$1@slb3.atl.mindspring.net>
References: <8cg55n$1kl$1 AT mailint03 DOT im DOT hou DOT compaq DOT com> <38EB9E19 DOT FDEEB2C4 AT corel DOT com> <esRG4.639$x62 DOT 2898 AT typhoon DOT southeast DOT rr DOT com>
NNTP-Posting-Host: 04.30.99.84
X-Server-Date: 6 Apr 2000 08:22:28 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In DJGPP it would look something like this:

First you need these headers:

#include <go32.h>
#include <sys/farptr.h>

A variable:

long tick;

Convert the real mode segment:offset pair to a linear address offset
(relative to _dos_ds) like this:

0x40 * 16 + 0x6c = 0x460

Use it in the _farpeekl() function like this:

tick = _farpeekl(_dos_ds, 0x460);

I hope this helps you.

"pwillard" <pwillard AT mindspring DOT com> wrote in message
news:esRG4.639$x62 DOT 2898 AT typhoon DOT southeast DOT rr DOT com...
>
> Actually, I'm not too afraid of straight C code, but accessing BIOS
> information as in  the FAQ
> made me very cautious. I'm not sure how to access the rom bios area to
> perform what the old pascal
> code was doing.
>
> Here is the snippet of Pascal:
>
> TICK :=  LONGINT(PTR($40, $6C)^);         {GET ROM BIOS TIMER TICK COUNT}
>
>  Should I be more creative when accessing the system as done in the
example?
> I mean, what's the magic?
>
> I know that the 8253/8254 uses a 4 byte area located at 0040:006C
> (segment:offset notation) for
> incrementing a counter and that's exactly what the code above does.
>
> I want to snap shot the counter, and compare it's value to a snap shot
later
> for speed calibration.  I
> just don't understand yet how to tell DJGPP to do this without whacking
the
> system into oblivion.
>
> Pete
> (Who's afraid to touch memory directly after reading the FAQ. )
>
> Jonathan Meunier <jonathanm AT corel DOT com> wrote in message
> news:38EB9E19 DOT FDEEB2C4 AT corel DOT com...
> > pwillard wrote:
> > >
> > > I'm converting some old pascal code for DJGPP and I have run into a
> snag.
> > > I'm not sure how to tell DJGPP to get the bios timer tick count
value...
> > > anybody know?
> >
> > I don't actually know how to do this (haven't read much documentation on
> > timers/cpu clock), but if you post the part of the pascal source that
> > does this, I'm pretty sure I (or someone else in this ng) could convert
> > it to C.
> >
> > .(Trancelucid).
> >   .  Jaune  .
>
>


- Raw text -


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