Date: Wed, 19 Jun 1996 18:25:29 +0200 (IST) From: Eli Zaretskii To: Peter Johnson Cc: djgpp AT delorie DOT com Subject: Re: Trapping the PAUSE key In-Reply-To: <31c5b238.7657104@news.mcs.net> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Mon, 17 Jun 1996, Peter Johnson wrote: > In many games, e.g. Doom, Terminal Velocity, etc, the "pause" key does > not pause the computer, but rather pauses the game. Obviously, the > pause key must have been trapped in some manner. Any ideas on doing > this in DJGPP? Either disabling the pause key entirely or somehow > having a function called when it is hit would be very valuable. PAUSE doesn't have its own scan code, but emulates a simultaneous press of two keys: Ctrl+NumLock. However, it uses the E1h precode byte to allow programs to distinguish between PAUSE keypress and actual Ctrl+NumLock, in a manner similar to the way editing keypad keys (like PageDown) are distinguished from the keys on the numeric keypad (like the 3/PgDn key). The bottom line is that when you press and release Ctrl+NumLock, the keyboard generates the sequence 1Dh 45h 9Dh C5h, while when you press PAUSE the generated sequence is E1h 1Dh 45h E1h 9Dh C5h. (Note that this latter sequence of scancodes includes *both* make and break codes, even if you press PAUSE and keep it pressed. This is different from Ctrl+NumLock which generates make sequence 1Dh 45h when you press them and break sequence 9Dh C5h when you release them.)