⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 read.c

📁 异步通讯C语言例行子程序
💻 C
字号:
/* A module of ASYNCx.LIB version 1.20 */

#include <dos.h>
#include "asyncdef.h"

/************************************************************
 Receive n objects of size s from the port associated with p
 within t eighteenths of a second. Start puting them into
 memory starting at where buf points. Return the number of
 whole objects received.
************************************************************/
int a_read(void *buf,int s,int n,ASYNC *p,int t)
{unsigned i;
 byte *bp;
 unsigned long t0,far *t1;
 if (p)
  {t1=(unsigned long far *)MK_FP(0x40,0x6c);
   t0=*t1;
   bp=(byte *)buf;
   n*=s;
   for(i=0;i<n && (*t1)-t0<=(unsigned long)t;i++)
     if (a_icount(p))
       *bp++=a_getc(p);
     else
       i--;
   return(i/s);
  }
 return 0;
} /* end of a_read(buf,s,n,p,t) */

⌨️ 快捷键说明

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