home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
progc
/
c_all592.arj
/
TI404.ASC
< prev
next >
Wrap
Text File
|
1992-02-25
|
2KB
|
133 lines
PRODUCT : TURBO C NUMBER : 404
VERSION : 1.0/1.5
OS : MS-DOS
DATE : January 12, 1988 PAGE : 1/2
TITLE : BIOSCOM EXAMPLE
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");
PRODUCT : TURBO C NUMBER : 404
VERSION : 1.0/1.5
OS : MS-DOS
DATE : January 12, 1988 PAGE : 2/2
TITLE : BIOSCOM EXAMPLE
while (1)
{
if (kbhit())
{
if ((in = getch())== ESC) exit(0);
bioscom(SEND, in, COM1);
}
if ( (out = bioscom(RECEIVE, 0, COM1) & 0x7F) != 0)
putch(out);
}
}