#include <bios.h>
#include <stdio.h>
#include <conio.h>
#define directionKey_Down 0x5000 /*向下的方向键*/
#define directionKey_Up 0x4800 /*向上的方向键*/
#define directionKey_Left 0x4b00 /*向左的方向键*/
#define directionKey_Right 0x4d00 /*向向的方向键*/
#define key_Space 0x3920 /*空格键*/
int main(void)
{
int key;
while(1) /*无限循环*/
{
if(bioskey(1)) /*获得按键消息*/
{
key=bioskey(0); /*消除按键消息队列*/
if(key==directionKey_Down)
printf("DirectionKey_Down is clicked\n");
else if(key==directionKey_Up)
printf("DirectionKey_Up is clicked\n");
else if(key==directionKey_Left)
printf("DirectionKey_Left is clicked\n");
else if(key==directionKey_Right)
printf("DirectionKey_Right is clicked\n");
else if(key==key_Space)
break;
}
}
}