|
|
Keyboard handling in C
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);
}
|
|
0
|
|
|
|
Reply
|
anon856525 (7)
|
1/21/2008 10:24:58 PM |
|
On Jan 21, 2:24=A0pm, anon856...@gmail.com wrote:
> 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
[snip]
You want news:comp.os.msdos.programmer
In the C-FAQ, section 19 is on "System Dependencies" like keyboard
interrupts, etc., but it won't really address your questions.
|
|
0
|
|
|
|
Reply
|
dcorbit (2696)
|
1/21/2008 10:34:36 PM
|
|
anon856525@gmail.com wrote:
>
> 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.
Modern Winders won't allow you to do that. You need to try a DOS
newsgroup, or possibly W98 or W95.
--
X-Mozilla-Status: 0009alconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
|
|
0
|
|
|
|
Reply
|
cbfalconer (19183)
|
1/22/2008 1:47:37 AM
|
|
|
2 Replies
25 Views
(page loaded in 0.129 seconds)
|
|
|
|
|
|
|
|
|