🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.msdos.programmer
1 messages
1 total messages Started by tjb Sun, 30 Aug 1992 00:28
com port problem
#341
Author: tjb
Date: Sun, 30 Aug 1992 00:28
54 lines
1871 bytes
Hi,
I have an Xt and a 386,
the XT is connected to a printer and a modem
the 386's COM2 is connected to the XT's COM1 through a null-modem
cable.
i want to be able to use the printer&modem from the 386
i can use the printer using a network program, but it's not compatible
with a lot of stuff, and takes up LOTS of memory.
i wanted to use the modem by writing a small C program that
makes the XT transfer COM1 to COM2 and COM2 to COM1
so that COM2(direct link to XT) on the 386 will function as a modem
  386               XT
 ---------      --------------
    COM2  ->   COM1  ->  COM2  ->  modem
    COM2  <-   COM1  <-  COM2  <-  modem

my program so far is:
---------------------------------------------------------
#include <conio.h>
#include <dos.h>
#undef inportb
#undef outportb
#define COM1 0x3f8
#define COM2 0x2f8
#define COM1S 0x3fd
#define COM2S 0x2fd
main()
{
    int com1,com1s,com2,com2s;
    while( !kbhit() )
    {
        com1s = inport( COM1S );
        if( com1s & 2)
        {
            com1 = inport( COM1 );
            outport( COM2, com1 );
            printf("got %d from com1\n",com1);
        }
        com2s = inport( COM2S );
        if( com2s & 2 )
        {
            com2 = inport( COM2 );
            outport( COM1, com2 );
            printf("got %d from com2\n",com2);
        }
    }
}
-----------------------------------------------------------
the program works if i type each letter twice slowly.
does anyone know how to make it work??
Thanks,
Omri Barak
Internet: barak@bguee.bgu.ac.il
Bitner  : barak@bguee
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads