[comp.lang.pascal] com port nightmare

pervect@bsu-cs.bsu.edu (Barrett Kreiner) (01/12/90)

I'm doing something Weird, but I think it has merit.
I'm trying to connect two com ports together and I'm loseing my mind.
It's like this: I have a terminal on my com1 port and a modem on my
com2 port.  I want to use the modem from terminal.  The modem is
internal to the pc.  I've played with the pascal async library, dosgate
and writing my own drivers using bios.  Dosgate and async won't play
together like good programs.  Async works fine, but supports only one
open com port I've looked the source over.. nasty to make it support
2 open.  So basically this is a general plea if ANYONE out there is
smart enough to at least get my two ports talking at once please Email
to me.

	Thanx for your support.
|---------------------------------------------------------------------|-----|
| Barrett Kreiner    ARPA: pervect@bsu-cs.bsu.edu   <-*New Address*   | :-] |
| Human to talk to about Ball State's Unix |--------------------------|-----|
| Ball State University. Muncie, Indiana   |This space left blank on purpose|
|------------------------------------------|--------------------------------|
| Disclamer: "I don't know them!  I'm a student, nobody listens to ME!"     |
| Pt.2 "I graduated.  I work with them now.. They STILL don't listen to me!"|
|---------------------------------------------------------------------------|

u-dmfloy%ug.utah.edu@cs.utah.edu (Daniel M Floyd) (01/12/90)

In article <10561@bsu-cs.bsu.edu> pervect@bsu-cs.bsu.edu (Barrett Kreiner) writes:

>I'm trying to connect two com ports ...
>It's like this: I have a terminal on my com1 port and a modem on my
>com2 port.  I want to use the modem from terminal.  The modem is
>internal to the pc. I've tried ...
>and writing my own drivers using bios.  Dosgate and async won't play
>together like good programs.  Async works fine, but supports only one
>open com port I've looked the source over.. nasty to make it support
>2 open.  So basically this is a general plea if ANYONE out there is
>smart enough to at least get my two ports talking at once please Email
>to me.
>
>	Thanx for your support.
>|---------------------------------------------------------------------|-----|
>| Barrett Kreiner    ARPA: pervect@bsu-cs.bsu.edu   <-*New Address*   | :-] |

Three methods spring to mind (the last is best if you can):
1)Interrupts
2)Polling
3)ctty

1) If you intend to do interrupts, you have to enable both the 8259A interrupts
number 3 and 4 (which correspond to interrupt vectors B and C in the
BIOS respectively), and enable the ports themselves. You'll have to
put in the right interrupt addresses and deal with conflicts.

2) If you do polling you may forget about the interrupts and poll com1 then
com2 rapidly using the BIOS interrupt vector.

3) CTTY is a DOS command that may be just what you want. Then see if you
can use your modem with the standard software. Try and see.

I hope this helps and makes sense.

Dan Floyd
8<D=

pmk@cip-s01.informatik.rwth-aachen.de (Michael Keukert) (01/13/90)

Try this for quick and dirty:

VAR f1,f2:File of byte;
     data:byte;

ASSIGN (f1,'COM1:');
ASSIGN (f2,'COM2:');
Reset(f1);
Rewrite(f2);

REPEAT
 READ(f1,data);
 WRITE(f2,data);
UNTIL EOF(f1);

CLOSE(f1);
CLOSE(f2);

This shall work for the beginning...

--------------------------------------------------------------------------
 Michael Keukert, Elsasstrasse 58, D-5100 Aachen 35, Phone: +49 241 513297
 Twenty bucks per day plus expenses, hundred in advance.      (Sam Spade)

paul@actrix.co.nz (Paul Gillingwater) (01/19/90)

>In article <10561@bsu-cs.bsu.edu> pervect@bsu-cs.bsu.edu (Barrett Kreiner) writes:
>I'm trying to connect two com ports ...
>It's like this: I have a terminal on my com1 port and a modem on my
>com2 port.  I want to use the modem from terminal.  The modem is
>internal to the pc. I've tried ...
>and writing my own drivers using bios.  Dosgate and async won't play
>together like good programs.  Async works fine, but supports only one
>open com port I've looked the source over.. nasty to make it support
>2 open.  So basically this is a general plea if ANYONE out there is
>smart enough to at least get my two ports talking at once please Email
>to me.

I run a two BBS, one is PCBoard running under DOS on a PC/XT (Amstrad),
the other one is a Zenith 386 running XBBS under UNIX.  The Amstrad,
a standard PC clone, has one serial port as standard.  I simply added 
a modem card set to COM2:, and run Kermit via DOORWAY to access the
UNIX box via COM1.   This was working just fine, until I got rid of the
modem card (it was not resetting correctly), and substituted a no-name
serial card with external modem.  Anyway, DOORWAY runs a DOOR under
PCBoard which is real clever about reading the video RAM, and sends ANSI
out COM2.  Kermit runs OK, and you can set various options like turning
of the status line and disabling drop to DOS.

Because of the hardware change causing characters to be lost, we're now 
working on writing a solution in Pascal or Modula which will use 
interrupts and large buffers, allowing for different speeds to be used.

I'll post the results to the net when we get it working.  Stay tuned!
-- 
Paul Gillingwater, paul@actrix.co.nz