Mail Archives: djgpp/1997/11/24/12:24:46
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 -