home *** CD-ROM | disk | FTP | other *** search
- #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;
-
- DJAsync asy(port);
-
- while (1)
- {
- int x,y;
-
- if (kb_ready())
- {
- char ch = kb_rx();
- if (ch == '~')
- exit(0);
- asy.Tx(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 (asy.Rdy())
- {
- char c = asy.Rx();
- write(1, &c, 1);
- }
- }
- return 0;
- }
-