home *** CD-ROM | disk | FTP | other *** search
- #include <dos.h>
- int rcvbyte(com_port)
- int com_port;
- {
- union REGS inreg, outreg;
- int ch;
-
- /* If there is a character waiting get it and return it, otherwise, return
- -1 */
-
- if(instat(com_port) != 0){
-
- inreg.x.dx = com_port;
- inreg.h.ah = 2;
- int86(0x14, &inreg, &outreg);
- ch = (0xff & outreg.h.al);
- return ch;
- } else return -1;
-
- }
-
- /* Check to see if there is a character in the MBBIOS buffer */
-
- int instat(p)
- int p;
- {
- union REGS inreg, outreg;
-
- inreg.x.dx = p;
- inreg.h.ah = 3;
- int86(0x14,&inreg,&outreg);
- return( (0x01 & outreg.h.ah ) );
- }
-
- putcom(p,ch)
- unsigned char ch;
- int p;
- {
- union REGS inreg, outreg;
-
- inreg.x.dx = p;
- inreg.h.ah = 3; /* check comm line status */
-
- /* mask to check if cts on and xmtr rgstr empty */
-
- do int86(0x14, &inreg, &outreg);
- while((0x2010 & outreg.x.ax) != 0x2010);
-
- inreg.x.dx = port;
- inreg.h.ah = 1; inreg.h.al = ch;
- int86(0x14, &inreg, &outreg);
- }
-
- void asc_enab()
- {}
- void asc_disab()
- {}
-