A
anon856525
Hi,
I'm trying to write a keyboard handle with Borland. I think the code
below should work, but it doesn't compile. The problem is I cannot set
the return of
getvect() to a void interrupt (*)(), ie
void interrupt (*old_int9)();
....
old_int9 = getvect (0x9);
I need a void interrupt function pointer so I can chain the old handle
to the new handle. Any help much appreciated. I'll attach the rest
of
the example program.
#include<stdlib.h>
#include<stdio.h>
#include<dos.h>
#include<conio.h>
#define TRUE 1
#define FALSE 0
void interrupt (*old_int9)();
void interrupt new_int9();
int scan_code,done = FALSE;
void interrupt new_int9()
{
disable();
scan_code = inport(0x60);
if (scan_code == 0x3b) done = TRUE; /* done = TRUE when F1 pressed */
old_int9(); /* chain the old interrupt */
enable();
}
void main ()
{
int old_scan_code;
char buffer[256];
clrscr();
old_int9 = getvect(0x9);
setvect (0x09,new_int9);
while (!done)
{ if (kbhit) getche();
}
setvect (0x09,old_int9);
}
I'm trying to write a keyboard handle with Borland. I think the code
below should work, but it doesn't compile. The problem is I cannot set
the return of
getvect() to a void interrupt (*)(), ie
void interrupt (*old_int9)();
....
old_int9 = getvect (0x9);
I need a void interrupt function pointer so I can chain the old handle
to the new handle. Any help much appreciated. I'll attach the rest
of
the example program.
#include<stdlib.h>
#include<stdio.h>
#include<dos.h>
#include<conio.h>
#define TRUE 1
#define FALSE 0
void interrupt (*old_int9)();
void interrupt new_int9();
int scan_code,done = FALSE;
void interrupt new_int9()
{
disable();
scan_code = inport(0x60);
if (scan_code == 0x3b) done = TRUE; /* done = TRUE when F1 pressed */
old_int9(); /* chain the old interrupt */
enable();
}
void main ()
{
int old_scan_code;
char buffer[256];
clrscr();
old_int9 = getvect(0x9);
setvect (0x09,new_int9);
while (!done)
{ if (kbhit) getche();
}
setvect (0x09,old_int9);
}