delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/24/12:24:46

Date: Mon, 24 Nov 1997 19:21:54 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Fabrice ILPONSE <fabrice AT asim DOT lip6 DOT fr>
cc: djgpp users group <djgpp AT delorie DOT com>
Subject: Re: djgpp slow (source files)
In-Reply-To: <34795F4D.599A@trash.lip6.fr>
Message-ID: <Pine.SUN.3.91.971124191920.25457A-100000@is>
MIME-Version: 1.0

On Mon, 24 Nov 1997, Fabrice ILPONSE wrote:

> main()
> {Vmem *u;
>  int a;
>  XON(320,200);
> 
>  do { Color(0,0,30,0);
>       Xtest();
>       Color(0,0,0,0);
>       WaitVBL();
>       if (kbhit()) a=getch(); else a=0;
>     } while (a!=27);
> 
>  return 0;
> }

You are calling `kbhit' inside the loop.  A call to `kbhit' requires a 
mode switch (it boils down to a call to the BIOS Int 16h function), which 
is much slower from protected mode.

If the `kbhit' call is just a means to break out of the loop, then I 
suggest replacing it with a SIGINT handler.  Then pressing Ctrl-C will 
cause the loop to be exited.  That should be much faster.

- Raw text -


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