From: "Tony O'Bryan" Newsgroups: comp.os.msdos.djgpp Subject: Re: Orbiting Spheres? Date: Sat, 02 May 1998 17:10:43 +0000 Organization: Southwest Missouri State Universtiy Lines: 16 Message-ID: <354B5393.FB8859AF@nic.smsu.edu> References: <000401bd75d9$069ac040$cf4b08c3 AT arthur> NNTP-Posting-Host: marie.a07.smsu.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Arthur wrote: > Is there an easy way of patching the keyboard to register a number of > different keys (say 6) being pressed at the same time? Of course there is, > but how is it done? With interrupts, of course. :) The most reliable way is to intercept the keyboard interrupt and keep track of which keys are down and which are not. Allegro uses an efficient method of using an array to track the state of each key. When a key is pressed, set the corresponding byte in the array. When the key is released, clear the appropriate byte in the array. Be aware that not all keyboards are created equal. Keyboards have a tendency to report only a few simultaneous keypresses, and the allowances vary among keyboards.