From: "WODRICH, M, M, WDRMAR002" To: djgpp AT sun DOT soe DOT clarkson DOT edu Date: Thu, 23 Mar 1995 13:12:33 SAST Subject: Re: How to intercept the Keyboard interruption? A. Appleyard wrote > sarda_jea AT lsi DOT supelec DOT fr wrote:- > > > Hello, I need your advice on how to use the keyboard. I am making a game > > which needs, I think, the interception of the keyboard interruption (mainly > > to know the state of the UP, DOWN, LEFT and RIGHT arrows). The problem is > > that I don't know how the interruptions exactly work in protected mode. If > > somebody has already done some procedures that can intercept the keyboard, > > it would be kind to send me the sources. If anybody knows how I can do > > without using interrupts, please tell me. Jean-Philippe. > > Call interrupt 0x21:- > [Int21 stuff deleted] This will work fine in a game where you only need to read one key at a time. For this, you could just use standard C routines like getch() (I think there is function that reads a key without echoing it). If you writing an arcade game (fer instance), where the player can press, say Ctrl+Alt+Space (at the same time), this wont work... I think you need a routine in the keyboard handler (Int 0x08 I think), which monitors the keyboard codes coming in to the interrupt. I wrote a simple TSR that looked for hot-keys in this way. The nice thing is that you get different codes for a press and a release for each key. So you could set up an array with the status of the keys you want to monitor, and then read this array in your program ... (Your int08 handler sets the array values depending on the press/release). PS : I have no clue how protected mode interrupts are different in DJGPP! This should be possible, though... Hope this helps! Mark.-- Mark Wodrich Email : mwodrich AT eleceng DOT uct DOT ac DOT za 13 Letchworth Road Pinelands " Excuse me, but I think your karma has 7405 just run over my dogma ..."