Category : C Source Code
Archive   : TEL2307S.ZIP
Filename : TEST14.C

 
Output of file : TEST14.C contained in archive : TEL2307S.ZIP
#ifdef __TURBOC__
#include "turboc.h"
#endif
#include
#include
#include
#include
#include
#include
#include
#ifdef MSC
#include
#include
#endif


/* #define DEBUG */

/*
* Global variables
*/

#define SERIAL 0x14
#define PORT 1

/*
* main ( argc, argv )
*
* Entry :
*
* parameter 1 : machine name
*
*/

int main(argc,argv)
int argc;
char *argv[];
{
union REGS inregs; /* register set going into the interrupt */
union REGS outregs; /* register set going out of the interrupt */
int i,cnt,ev,what,dat;
unsigned int str_length;
char *errmsg,
*str;
char c;

if(argc<2)
exit(1);

printf("int14h vector=%p\n",_dos_getvect(0x14));
printf("int1Ch vector=%p\n",_dos_getvect(0x1C));

#ifdef QAK
inregs.h.ah=3; /* set to initialize the comm. port */
inregs.x.dx=PORT; /* use port two */
int86(SERIAL,&inregs,&outregs); /* call to initialize the interrupt */
printf("ax=%X\n",outregs.x.ax); /* print the return value */
#endif

inregs.h.ah=0; /* set to initialize the comm. port */
inregs.x.dx=PORT; /* use port two */
int86(SERIAL,&inregs,&outregs); /* call to initialize the interrupt */
printf("ax=%X\n",outregs.x.ax); /* print the return value */

inregs.h.ah=1; /* set to send a character */
inregs.h.al=2; /* send initialization character */
inregs.x.dx=PORT; /* use port two */
int86(SERIAL,&inregs,&outregs); /* call to initialize the interrupt */
printf("ax=%X\n",outregs.x.ax); /* print the return value */

str=argv[1];
str_length=strlen(str);
for(i=0; i<(int)str_length; i++,str++) {
inregs.h.ah=1; /* set to send a character */
inregs.h.al=*str; /* send name character */
inregs.x.dx=PORT; /* use port two */
int86(SERIAL,&inregs,&outregs); /* call to initialize the interrupt */
printf("ax=%X\n",outregs.x.ax); /* print the return value */
} /* end for */

puts("right before opening a connection");
inregs.h.ah=1; /* set to send a character */
inregs.h.al=3; /* send initialization character */
inregs.x.dx=PORT; /* use port two */
int86(SERIAL,&inregs,&outregs); /* call to initialize the interrupt */
printf("ax=%X\n",outregs.x.ax); /* print the return value */

puts("after opening a connection");
c = 0;
puts("before dropping into the do loop");
do {
if(kbhit()) { /* has key been pressed */
c=(char)getch();
if(c==16)
break;
inregs.h.ah=1; /* set to send a character */
inregs.h.al=c; /* send character */
inregs.x.dx=PORT; /* use port two */
int86(SERIAL,&inregs,&outregs); /* call to initialize the interrupt */
}
#ifdef QAK
puts("before int14check() call");
#endif
dat=int14check();
#ifdef QAK
printf("after int14check() call, dat=%X\n",dat);
#endif
if(dat&0x0100) { /* check for data being ready */
#ifdef QAK
printf("data ready, dat=%x",dat);
#endif
c=int14receive();
#ifdef QAK
printf("c=%x:%d:%c\n",(unsigned)c,(unsigned)c,(char)c);
#endif
putchar(c);
} /* end if */
} while(c!=16); /* Ctrl-P, arbitrary escape */
#ifdef QAK
timedeinst(); /* remove the timer interrupt handler */
int14deinst(); /* remove the int 14h handler */
netclose(pnum[2]);
netshut();
#endif
exit(0);
}



  3 Responses to “Category : C Source Code
Archive   : TEL2307S.ZIP
Filename : TEST14.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/