delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/05/26/01:36:13

Date: Sun, 26 May 2002 08:30:57 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Mario Feldberg <whiteindian AT arcor DOT de>
cc: djgpp AT delorie DOT com
Subject: Re: [bug] delay() doesn't work under WinXP
In-Reply-To: <3cefc418_2@news.arcor-ip.de>
Message-ID: <Pine.SUN.3.91.1020526082845.26497F-100000@is>
MIME-Version: 1.0
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

On Sat, 25 May 2002, Mario Feldberg wrote:

> The delay() function (from dos.h) doesn't seem
> to work under WinXP. There's no delay.

Thanks for the report.

Could you please investigate this a little more?  The full source of the 
DJGPP implementation of `delay' is attached below; could you please paste 
this code into your program, and then add some print-outs inside the 
loop to help use understand what goes wrong with that code?

TIA



/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <dos.h>
#include <dpmi.h>

void delay(unsigned msec)
{
  __dpmi_regs r;
  while (msec)
  {
    unsigned usec;
    unsigned msec_this = msec;
    if (msec_this > 4000)
      msec_this = 4000;
    usec = msec_this * 1000;
    r.h.ah = 0x86;
    r.x.cx = usec>>16;
    r.x.dx = usec & 0xffff;
    __dpmi_int(0x15, &r);
    msec -= msec_this;
  }
}

- Raw text -


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