Mail Archives: djgpp/2000/04/06/05:32:47
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 -