468,513 Members | 1,834 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

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);
}
Jan 21 '08 #1
2 3721
On Jan 21, 2:24*pm, 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.
Jan 21 '08 #2
an********@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

Jan 22 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Cyber | last post: by
8 posts views Thread by RJ45 | last post: by
reply views Thread by Fromethius | last post: by
7 posts views Thread by Brian Ward | last post: by
2 posts views Thread by Justin | last post: by
11 posts views Thread by vbguy2008 | last post: by
8 posts views Thread by BD | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.