Category : Assembly Language Source Code
Archive   : ASYNLIB2.ZIP
Filename : TERM.C

 
Output of file : TERM.C contained in archive : ASYNLIB2.ZIP
/*
Simple-Term

A short terminal emulation package to show the use of the
ASYNC communications library.

In case you are wondering, the COM Port settings are hard coded in
the defines right before main(), change these as you wish.

Also, this program does not emulate any known terminal. Instead
it outputs all text via DOS, so if you run ANSI.SYS then you can
have a more useable program-- but since this is an example anyway,
I sure you don't mind.
*/

#include
#include
#include
#include "async.h"

#define COM_PORT COM1
#define BAUD_RATE 38400
#define COM_SETTINGS (BITS_8 | STOP_1 | NO_PARITY)

int main()
{
int c;

printf( "Simple-Term. Press F10 to Quit.\n\n");

if( AsyncInit( COM_PORT))
{
printf( "Error initalizing COM Port.\n");
return(1);
}

AsyncSet( BAUD_RATE, COM_SETTINGS);
AsyncHand( DTR | RTS);

for(;;)
{
/* If a character was recieved, print it to the console */
if( (c=AsyncIn())!=0)
putch( c);

/* If a key has been pressed */
if( kbhit() )
{
c=getch();
if( c==0) /* Check for 'extended characters */
{
c=getch(); /* Get the extended code */
if( c==0x44) /* Exit if it is a F10 */
break;
}
else
AsyncOut(c);
}

/* If the buffer has a lot in it, drop RTS and empty the buffer */
if( AsyncInStat()>4096)
{
AsyncHand( DTR); /* Drop RTS */
while( AsyncInStat()>0)
putch( AsyncIn() );
AsyncHand( DTR | RTS);
}
}

AsyncStop();
return(0);
}


  3 Responses to “Category : Assembly Language Source Code
Archive   : ASYNLIB2.ZIP
Filename : TERM.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/