auxecho.c

来自「HT系列掌机部分功能测试程序(含源码)」· C语言 代码 · 共 56 行

C
56
字号
/*
  Project must include
          commplus.c
          infrared.c
          cplib.lib             */

  #include "commplus.h"
  #include <stdio.h>

  int ESCpressed();

  int ESCpressed()
  {
   int result=0;
   asm {
     mov   ah, 1
     int   16h
     jz    Retit
     xor   ah, ah
     int   16h
     cmp   ax, 011bh
     jnz   Retit
     not   result
   }
   Retit:
   return(result);
  }


  main()
  {
   unsigned char ascch, auxb, auxstat;
   int exitloop=0;
   unsigned char workmode, commport;
   unsigned int  baudrate;

   GetCommMode(&workmode, &commport, &baudrate);
   SetCommMode(3, commport, baudrate);
   EnableRx(0);

   for (ascch=0; (!exitloop); ascch++) {
      PutAuxByte(ascch);
      do
        exitloop=ESCpressed();
      while (!ExistAuxBGot(&auxb, &auxstat) && (!exitloop));
      if (!exitloop)
        if (auxb==ascch)
          printf("ASCII code %X echoed OK!\n", (unsigned int)ascch);
        else
          printf("ASCII code %X echoed error by %X!\n", (unsigned int)ascch,
                 (unsigned int)auxb);
   }
   DisableRx();
   return 0;
  }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?