EGL--键盘类函数实现文件 KEY.INC

类别:编程语言 点击:0 评论:0 推荐:

/*
  KEY.INC
*/

int GetKey()
{
  int character,ext_char=0;
  if((character=getch())!=0)
     return(character);
  else
     ext_char=getch();
  return(ext_char*100+character);
}
int GetStatusKey(int cmd)
{
   char far *statuskey=(char far *)0x00000417;
   return( (*statuskey&cmd)!=0?1:0 );
}
int Kbhit()
{ int head,end;
  head=peek(0x40,0x1a);
  end=peek(0x40,0x1c);
  return( head==end?0:1 );
}
void ClearKeyBuffer(void)
{ int head,end;
  head=peek(0x40,0x1a);
  poke(0x40,0x1c,head);
}

本文地址:http://com.8s8s.com/it/it25072.htm