key board handler in C
Posted: Sat Jul 26, 2008 11:35 pm
hi all
i was trying to make an interrupt handler for the key board useing the functions setvect and getvect but it didn't work..is there any obvious mistake in my code ?
thanks in advance.
i was trying to make an interrupt handler for the key board useing the functions setvect and getvect but it didn't work..is there any obvious mistake in my code ?
thanks in advance.
Code: Select all
#include <stdio.h>
#include <dos.h>
#define kbint 0x09
#define kbport 0x60
void (interrupt far *old_isr)();
void interrupt far kbhandler()
{
char kb = inport(kbport);
if (kb == 'x')
exit(1);
}
main()
{
old_isr = getvect(kbint);
setvect(kbint,kbhandler);
while(1)
{
printf("hello\n");
delay(10000000);
}
}