关于中断的问题
void interrupt (*oldhandler)(void);
void interrupt myhandler(void);
int m_ai[10];
void main()
{
disable();
oldhandler = getvect(0x8);
setvect(0x8,myhandler);
enable();
/*问题和差别就在下面*/
/*the first*/
while(1); //----------------------------A
getch(); //----------------------------B
printf("hello!");
disable();
setvect(0x08,oldhandler);
outportb(0x20,0x20);
enable();
getch();
}
/*The sub-function is used to data-in,data-cal,data-out*/
void interrupt myhandler(void)
{
......
int i;
for(i = 0;i < 10;i++)
{
printf("%d\n",m_ai[i]);
}
oldhandler();
outportb(0x20,0x20);
}
如果用A语句的话:数据可以正确一行行的显示,但是如果在执行过程中用ctrl-c中断后,系统光标闪动,但是不响应键盘,只有RESET。
如果用B语句的话:数据显示出一行行的字符,而不是数字,但是用ctrl-c中断后,系统没有死。
另外,程序执行时好象CPU的占用率很高,应该是100%!
请各位高手指点!