Mail Archives: djgpp/2005/10/08/13:37:34
Nobody responded, so I had to work it out myself, but perhaps the solution
can help other people:
The problem seems that WinXP does not bother to update BIOS variables
unless BIOS calls are actually made. That means that a loop waiting for
_farpeekl(_dos_ds, 0x46c), to return a different value, will never exit. To
make it work, one has to call BIOS in the loop. I used
int GetTick(void)
{
__dpmi_regs r;
int iRet;
r.h.ah = 0x11; // check keyboard status and ignore result
__dpmi_int(0x16, &r);
iRet = _farpeekl(_dos_ds, 0x46c);
}
Having to do a BIOS call anyway, one can probably just use the BIOS call
to get the ticks directly using Int 0x1a, Function 0. I very much doubt that
the midnight passed flag will influence Win2K/XP.
Note that the clock() function in LIBC suffers from the same problem.
On 7 Oct 2005 at 17:33, Gerrit van Niekerk wrote:
> My program, which does a lot of integer calculations and an occasional
> printout, hangs after a time when running in a WinXP DOS-box. It hangs
> so badly that Ctrl-C can't get it out - the DOS-box must be aborted. On a
> DOS system with CWSDPMI it works without a hitch.
>
> The only "funny" thing the program does is to read the BIOS timer variable
> using "_farpeekl(_dos_ds, 0x46c);".
>
> I am using the "17-Nov-2003 DJGPP CVS Development Bin (djdev)",
> DJGPP Version 2.04 BETA 1 PRE RELEASE BY ANDREW COTTRELL
> BUILT WITH CVS LIBC OF 16-November-2003
>
> Version 2.03 gave similar results.
>
> Any help will be appreciated.
>
> ===============================================
> Gerrit van Niekerk
> GP van Niekerk Ondernemings BK
> Roosstraat 211, Meyerspark, 0184, South Africa
> Tel: +27(12)8036501 Fax SA: 0866 413 555
> Fax Int'l: +12(06)2034131
> Email: gerritvn AT gpvno DOT co DOT za
> Web: http://www.gpvno.co.za
> ===============================================
>
>
>
===============================================
Gerrit van Niekerk
GP van Niekerk Ondernemings BK
Roosstraat 211, Meyerspark, 0184, South Africa
Tel: +27(12)8036501 Fax SA: 0866 413 555
Fax Int'l: +12(06)2034131
Email: gerritvn AT gpvno DOT co DOT za
Web: http://www.gpvno.co.za
===============================================
- Raw text -