Date: Mon, 12 Jan 1998 11:53:02 +0200 (IST) From: Eli Zaretskii To: Anthony DOT Appleyard AT umist DOT ac DOT uk cc: DJGPP AT delorie DOT com Subject: Re: Hooking interrupt 9 in a laptop In-Reply-To: <1E6A8F763CA@fs2.mt.umist.ac.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Thu, 8 Jan 1998, Anthony.Appleyard wrote: > A.Appleyard wrote:- > > If int09 is hooked anyway while a djgpp C++ program is running, couldn't > > the next revision of djgpp alter that hook code to save the raw keyboard > > events in a 128-byte circular buffer? > > Eli Zaretskii replied:- > > It will, if you write this stuff and submit it to DJ Delorie ;-). > > /* If this assembler subroutine was put in DJGPP\SRC\LIBC\GO32\EXCEPTN.S and > called from any start of interrupt 9 hook routines such as ___djgpp_kbd_hdlr > and ___djgpp_kbd_hdlr_pc98, it should save the raw keyboard events in a > circular buffer which the user could read without having to re-hook interrupt > 9 himself. Thanks for your contribution. However, this is not the way to submit changes to the DJGPP library. You need: 1) submit the changes as output by the `diff' program run like so: diff -c src/libc/go32/exceptn.old src/libc/go32/exceptn.S > diffs 2) send the diffs to DJ Delorie directly (it's a good idea to cc: djgpp-workers AT delorie DOT com as well). And while we are at that, I have two comments about your code. First, you don't save the keyboard shift status (which Ctrl/Shift/Alt keys were pressed when the keyboard handler was invoked). Without that info, you will have hard time distinguishing between `a' and 'A' and between `=' and `+'. And second, won't it be a better idea to make a provision for a user-defined function to be called, rather than specific hard-wired code? Your code might be good for you and some others, but someone some day will need a slightly different code, like a larger keyboard buffer. I suggest to define a pointer to a function, and if it is non-zero, the keyboard handler will push the key scan code and the keyboard shift status bit as a single combined int on to the stack and call that function. This way, the code that is locked in memory doesn't get bloated when you don't need the feature, and those who do need it, can easily get it any way they want.