home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1 / HamRadio.cdr / rtty / tlmdc / tmp.c < prev    next >
C/C++ Source or Header  |  1990-01-29  |  1KB  |  58 lines

  1. #include <dos.h> 
  2. int rcvbyte(com_port)
  3. int com_port;
  4. {
  5.   union REGS inreg, outreg;
  6.   int ch;
  7.  
  8. /* If there is a character waiting get it and return it, otherwise, return
  9.     -1 */
  10.  
  11.     if(instat(com_port) != 0){
  12.  
  13.         inreg.x.dx = com_port;
  14.         inreg.h.ah = 2;
  15.         int86(0x14, &inreg, &outreg);
  16.         ch = (0xff & outreg.h.al);
  17.         return ch;
  18.     } else return -1;
  19.  
  20. }
  21.  
  22. /* Check to see if there is a character in the MBBIOS buffer */
  23.  
  24. int instat(p)
  25. int p;
  26. {
  27.   union REGS inreg, outreg;
  28.  
  29.     inreg.x.dx = p;
  30.     inreg.h.ah = 3;
  31.     int86(0x14,&inreg,&outreg);
  32.     return( (0x01 & outreg.h.ah ) );
  33. }
  34.  
  35. putcom(p,ch)
  36. unsigned char ch;
  37. int p;
  38. {
  39.   union REGS inreg, outreg;
  40.  
  41.   inreg.x.dx = p;
  42.   inreg.h.ah = 3;       /* check comm line status */
  43.  
  44. /* mask to check if cts on and xmtr rgstr empty */
  45.  
  46.   do int86(0x14, &inreg, &outreg);
  47.       while((0x2010 & outreg.x.ax) != 0x2010);
  48.  
  49.   inreg.x.dx = port;
  50.   inreg.h.ah = 1;   inreg.h.al = ch;
  51.   int86(0x14, &inreg, &outreg);
  52. }
  53.  
  54. void asc_enab()
  55. {}
  56. void asc_disab()
  57. {}
  58.