Mail Archives: djgpp/1995/10/08/15:53:07
Xref: | news-dnh.mv.net comp.os.msdos.djgpp:2485
|
Path: | news-dnh.mv.net!mv!news.sprintlink.net!in2.uu.net!news.compuserve.com!news.production.compuserve.com!news
|
From: | Owen <100607 DOT 3203 AT CompuServe DOT COM>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Keyboard handler
|
Date: | 8 Oct 1995 12:47:23 GMT
|
Organization: | CompuServe, Inc. (1-800-689-0736)
|
Lines: | 24
|
To: | djgpp AT sun DOT soe DOT clarkson DOT edu
|
Dj-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I am using V2 beta of DJGPP and trying to replace the default
keyboard interupt (9), I can do this in Turbo C++ but I don't
quite understand the DPMI functions as the info program explains
them. when i run the program below it crashes if i press a key.
could someone help me. Thanks for and help in advance
int keys;
void keyb_handler(void);
void keyb_handler()
{ keys++; }
main()
{
long delay,tmp;
__dpmi_paddr old_handler,new_handler;
__dpmi_get_protected_mode_interrupt_vector(9,&old_handler);
new_handler.offset32=(long)keyb_handler;
new_handler.selector=_go32_my_ds();
if (__dpmi_set_protected_mode_interrupt_vector(9,&new_handler)==0)
{
for (delay=0; delay<10000 ; delay++) tmp++;
__dpmi_set_protected_mode_interrupt_vector(9,&old_handler);
printf("%d",keys);
}
}
- Raw text -