home *** CD-ROM | disk | FTP | other *** search
- The following program demonstrates the use of the Turbo C run
- time library function bioscom:
-
-
- /* BIOSCOM.C */
-
- #include <bios.h>
- #include <conio.h>
-
- #define COM1 0
- #define COM2 1
-
- #define SET 0
- #define SEND 1
- #define RECEIVE 2
- #define STATUS 3
-
- #define ESC '\x1B'
-
- #define BAUD_300 0x40
- #define BAUD_1200 0x80
-
- #define PARITY_NONE 0x00
- #define PARITY_ODD 0x08
- #define PARITY_EVEN 0x18
-
- #define BITS_7 0x02
- #define BITS_8 0x03
- #define STOP_1 0x00
- #define STOP_2 0X04
-
- main()
- {
- int register out, in;
-
-
- bioscom(SET, BAUD_1200 | BITS_7 | STOP_1 | PARITY_NONE,
- COM1);
-
- cprintf("... BIOSCOM [ESC] to exit ...\n");
-
- while (1)
- {
- if (kbhit())
- {
- if ((in = getch())== ESC) exit(0);
- bioscom(SEND, in, COM1);
- }
- if ( (out = bioscom(RECEIVE, 0, COM1) & 0x7F) != 0)
- putch(out);
- }
- }
-