Mail Archives: djgpp/1995/02/13/14:30:50
Hi,
When I first started using DJGPP (1.10) there was no way to grab the
keyboad interrupt 9h. Is it possible now? All I want to do is to remap the
numlock key and for this I need to know when it is pressed and released.
Below, I have attached the int 9 handler that I use for BCC. Is there any
way I can get the same effect using djgpp? I do not care if I use the
hardware interrup or not. I just want the effect.
void interrupt int9_handler(void)
{
unsigned char s, s1;
unsigned int offset, f1_scan = 0x3B00; /* f1 key */
unsigned int *p;
unsigned int numlock = 0x45;
s1 = *shift & 0xF; /* ignoring caps, ins, num lock, scroll lock */
s = inp(0x60);
if (s1 & 0x04) /* control key */
{
if (s == 28) /* Control - enter, ignore it!! */
{
s = inp(0x61);
outportb(0x61, s | 0x80);
outportb(0x61, s);
outportb(0x20, 0x20);
return;
}
}
else if (NumLock_Is_Gold && ((s & 0x7F) == numlock))
{
if (s == numlock)
{
offset = *kbnext;
offset += 2;
if (offset == *kbend) offset = *kbbeg;
if (offset != *kbptr) /* buffer not full */
{
p = (unsigned int *) (0x400L + (*kbnext));
*p = f1_scan;
*kbnext = offset;
}
}
s = inp(0x61);
outportb(0x61, s | 0x80);
outportb(0x61, s);
outportb(0x20, 0x20);
return;
}
(*oldint9)();
}
Thanks,
--John
- Raw text -