home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_08_08
/
8n08084a
< prev
next >
Wrap
Text File
|
1990-07-18
|
1KB
|
40 lines
#define ACK_BIT 128 /* keyboard acknowledge bit */
#define HOT_Key 30 /* scan code for toggle key */
static void interrupt (*old_int)(); /* original int 0x09 */
static int toggle; /* Toggled value */
void interrupt my_interrupt() /* ours */
{
unsigned char scan_code, ack;
scan_code = inportb(0x60); /* scan code from 8255 PIC */
if (scan_code == HOT_Key) /* the one we watch */
{
toggle ^= 1; /* our toggle */
scan_code = inportb(0x61); /* control port */
outportb(0x61,scan_code | ACK_BIT);
/* send keyboard ACK */
outportb(0x61,scan_code); /* clear ack*/
outportb(0x20,0x20); /* enable hardware interrupts */
}
else
(*old_int)(); /* normal processing */
}
void install()
{
old_int = _getvect(0x9); /* save old one */
_setvect(0x9,my_interrupt); /* install new one */
}
void remove()
{
_setvect(0x9,old_int); /* restore original state */
}