home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
progmisc
/
djasy10d.zip
/
ATEST.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-11
|
908b
|
55 lines
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <io.h>
#include "djasync.h"
#ifdef __GNUC__
#include <gppconio.h>
#else
#include <conio.h>
#endif
#include <dos.h>
main(int ac, char** av)
{
int port = ac > 1 ? atoi(av[1]) - 1 : 0;
int show = ac > 2;
int msec = ac > 2 ? atoi(av[2]) : 0;
if (!async_init(port))
return 1;
while (1)
{
int x,y;
if (kb_ready())
{
char ch = kb_rx();
if (ch == '~')
exit(0);
async_tx(port,ch);
}
if (show) {
if (msec)
delay(msec);
x=wherex();
y=wherey();
gotoxy(1,1);
cprintf("%04d %04d",async_cnt(port),async_overflow(port));
gotoxy(x,y);
}
if (async_ready(port))
{
char c = async_rx(port);
write(1, &c, 1);
}
}
return 0;
}