delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/10/08/13:37:34

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Gerrit van Niekerk" <gerritvn AT gpvno DOT co DOT za>
Organization: GPvNO
To: djgpp AT delorie DOT com
Date: Sat, 08 Oct 2005 19:36:11 +0200
MIME-Version: 1.0
Subject: Re: Program hangups running in WinXP DOS box
Message-ID: <43481FAB.3020.396AE49B@localhost>
In-reply-to: <4346B157.13235.33D3EE49@localhost>
X-mailer: Pegasus Mail for Windows (4.21c)
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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 -


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