home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / PASCAL / MISCTI10.ZIP / TI404.ASC < prev    next >
Encoding:
Text File  |  1988-05-02  |  920 b   |  53 lines

  1. The following program demonstrates the use of the Turbo C run
  2. time library function bioscom:
  3.  
  4.  
  5.                               /* BIOSCOM.C */
  6.  
  7. #include <bios.h>
  8. #include <conio.h>
  9.  
  10. #define COM1        0
  11. #define COM2        1
  12.  
  13. #define SET        0
  14. #define SEND        1
  15. #define RECEIVE    2
  16. #define STATUS        3
  17.  
  18. #define ESC        '\x1B'
  19.  
  20. #define BAUD_300    0x40
  21. #define BAUD_1200    0x80
  22.  
  23. #define PARITY_NONE    0x00
  24. #define PARITY_ODD    0x08
  25. #define PARITY_EVEN    0x18
  26.  
  27. #define BITS_7        0x02
  28. #define BITS_8        0x03
  29. #define STOP_1        0x00
  30. #define STOP_2        0X04
  31.  
  32. main()
  33. {
  34.     int register out, in;
  35.  
  36.  
  37.     bioscom(SET, BAUD_1200 | BITS_7 | STOP_1 | PARITY_NONE,
  38.             COM1);
  39.  
  40.     cprintf("... BIOSCOM [ESC] to exit ...\n");
  41.  
  42.     while (1)
  43.     {
  44.     if (kbhit())
  45.     {
  46.         if ((in = getch())== ESC) exit(0);
  47.         bioscom(SEND, in, COM1);
  48.     }
  49.     if ( (out = bioscom(RECEIVE, 0, COM1) & 0x7F) != 0)
  50.         putch(out);
  51.     }
  52. }
  53.