Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: OT: Redirecting Keyboard Interrupt

Author: Lieven Clarisse

Date: 05:05:31 01/05/03

Go up one level in this thread


On January 05, 2003 at 07:11:02, Steve Schooler wrote:

>Couldn't find specific newsgroup to query.  Request insights or newsgroup
>reference(s):
>
>Old dos game intercepts specific key press to trigger action (i.e. 'p'
>triggers POW - explosive).  Keyboard configuration inconvenient; wish to
>trigger POW via 'a'.  Tried device = ansi.sys + appropriate escape keys.
>Separately tried shareware TSR (e.g. xkeyb.exe).
>
>These failures imply that the old dos game is intercepting keyboard
>interrupt before it's written to stdout (et al).  Therefore, TSR that
>converts key press 'a' to stdout 'p' is ineffective.  Consequently, need
>TSR to intercept 'a' keyboard interrupt (et al) and convert it to 'p'
>keyboard interrupt.
>
>Software only solution required... no keyboard rewiring allowed.  If
>expert indicates attempt futile, this will save me time.

There is a solution, but it isn't easy:

you need to write a TSR that captures interrupt 9,

void interrupt get_out(...);
void interrupt (*oldfunc)(...);

oldfunc = _dos_getvect(9); //you'll need this later on
_dos_setvect(9,get_out); //redirecting it to a self made function


check the keyboard to see which key it is, and put a different key in it
void interrupt get_out(...)
{
   key=inp(0x60);
   //check if the key, is your key
   outp(..); //set the new key, don't know if this is gone work!!
   outp(0x20, 0x20); //don't know why but they usually put this here too
}

If you look a round a bit on the net, i think much better code is available of
intercepting interrupts.

Writing a good TSR requires lots of skills though, so, if you realy want to do
it; I suggest looking for a TSR that is able to capture keyboard input, and
adapting it to your needs.






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.