PDA

View Full Version : why interrupt 0x09 can't work?


econoy
08-21-2004, 11:55 AM
I copied those code form a book.Just a simple example.
codes here:
#include<stdio.h>
#include<conio.h>
#include<dos.h>

#define MAX 10
int count=0;
void (interrupt *oldhandle)();
void interrupt key()
{
(*oldhandle)();
disable();
count++;
enable();
}
main()
{
int key;
oldhandle=getvect(9);
setvect(9,key);
while(count<MAX)
{
if(kbhit()!=0)
{
key=getch();
printf("count=%4i,key=%4i\n",count,key);
}
}
setvect(9,oldhandle);
}

But it cannot work.My OS is windows.Is it the reason?
I am a new comer to c.I want to get inputs from user in graphics mode,so I captured interrupt 0x09.In this interrupt function,I get
inputs.Anyone who can give me a better idea?How can I get
inputs in graphics mode?

stuka
08-22-2004, 10:52 AM
I'm guessing that you're using a newer Windows (2k, XP). In that case, you can't alter the interrupts directly.

econoy
08-23-2004, 03:58 AM
yep,you are right.My os is widnows XP.But I had successfully
captured other interrupts,such as 0x1c(time interrupt),why?

PS:How can I get inputs and echo it on the display in graphics
mode?I'm a new comer,so... :~)

maca
11-20-2004, 05:46 PM
hello

I think at you have twice definition to SYMBOL
"key", You are defined function key and variable key.


function

void interrupt key(){};

and in main same name variable

main()
{
int key;
};