Mail Archives: djgpp/1997/10/27/14:32:41
On Mon, 27 Oct 1997 06:58:39 -0600, Mark Slagell
<bald_soprano AT nospam DOT usa DOT net> wrote:
> Michael Mauch wrote:
> > > What I'm trying to get, ultimately, is a reliable 200hz interrupt.
> >
> > On plain DOS you can use the libc function uclock(), on Windows/Win95
> > you can use the puclock() function that is in the DJGPP mail archives
> > at www.delorie.com (search for puclock()).
>
> That would provide a high-resolution timer, but not an interrupt per se,
> or would it?
Yes, uclock() is only a timer function, but that is no real difference
if the interrupt handler function only updates a timer variable to make
high resolution timing possible. And IMHO there's not much more that you
can do safely and easily inside a timer interrupt handler. I doubt that
all of the libc functions are reentrant; most DOS functions are not
reentrant unless you look at the InDos flag.
> I can get PCTIME running at the right speed by removing this line from
> pm_new8h():
> ++ticks_8h;
>
> So it would seem that under Windows, both the protected mode and real
> mode handlers get called with every timer tick, and under DOS only the
> real mode handler gets called.
On my machine I get illegal instruction message boxes from Win95
when/after using test8.exe, so it seems to be not very safe anyways. I
don't know in which case which of the handlers (real mode or protected
mode) is called, but one thing that is obviously a no-no in Windows95 is
trying to reprogram the timer chip like it's done in the init8h()
function. Windows95 reprograms the timer chip itsself every now and
then, so attempts from user programs to do so will fail or at least give
no reliable results. The uclock() function has this same problem, but
puclock() uses a Windows function so it doesn't have to reprogram the
timer chip.
Regards...
Michael
- Raw text -