Author: Ratko V Tomic
Date: 19:08:38 10/07/99
Go up one level in this thread
> I have discovered on my K5 computer that calling the keyboard input > too often slows down the program considerably. Even in pure DOS > (the Windows scheduling algorithm has nothing to do with the problem). In DOS and Windows all kinds of code (BIOS, DOS, network drivers, schedulers, screen blankers and other TSRs) attach to the interrupt 0x16 (kbd interrupt), which makes the overhead erratic. The quickest way to check kbd for DOS programs, bypassing any such overhead in plain DOS or in DOS Box under Windows, is to check the keyboard buffer pointers, i.e. in C you can declare a pointer: short far *kbd=0x41a; Then you can test for key present using a macro: #define anykey() (kbd[0]!=kbd[1]) which evaluates true if (and only if) there is a key in the buffer. Even the 16-bit Windows programs can use this via predefined selectors which cover BIOS data area (imported value representing BIOS data selector is named __0040H). The overhead is minimal and predictable.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.