/* 1. Compiler: TC 2.0 2. Mode: Large 3. Project: Syskey.prj Syskey.c ..\lib\8000l.lib ..\lib\tcpipl.lib 4. Explain: To show the botten name which you cilck on monitor. 5. Hordware: 8831 It's compiled by Tony ----------------------------------------------------------------------------------- */ #include #include #include #include #include #include"..\LIB\8000.h" #include"..\LIB\vxcomm.h" /*----------------------------------------------------------------------------------*/ int IsSystemKey(void); int GetSystemKey(void); void ClearSystemKey(void); unsigned char far *KeyStatus=(char far *)0x00400078; void main(void) { int quit=0; unsigned char oldKeyStatus=0xff; int type; int ver; type=Is8000(); /*detect the current operation system*/ if(type) { ver=GetLibVersion(); Print("Hello 8831! (Flash memory is %d K)\n\r",type); Print("Library version is %d.%02d",ver>>8,ver&0xff); } else { Print("Hello PC!, this program is not run under 8831."); return; } Print("Test system key...\n\r"); ClearSystemKey(); while(!quit){ if(IsSystemKey()){ switch(GetSystemKey()){ case SKEY_UP: Print("UP KEY\n\r"); break; case SKEY_DOWN: Print("DOWN KEY\n\r"); break; case SKEY_SET: Print("SET KEY\n\r"); break; case SKEY_MODE: Print("MODE KEY\n\r"); break; } } if(oldKeyStatus != *KeyStatus){ oldKeyStatus = *KeyStatus; Print("KeyStatus=%X ",oldKeyStatus); if(oldKeyStatus & SKEY_MODE_DOWN) Puts("[MODE]"); if(oldKeyStatus & SKEY_UP_DOWN) Puts("[UP]"); if(oldKeyStatus & SKEY_DOWN_DOWN) Puts("[DOWN]"); if(oldKeyStatus & SKEY_SET_DOWN) Puts("[SET]"); if(oldKeyStatus & 0x0F) Puts(" --> is press down\n\r"); if(!(oldKeyStatus & 0x0F)) Puts("All key released\n\r"); } if(Kbhit()){ if(Getch()=='q') quit=1; } } }