🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #271

Re: Communicating over a null modem

#271
From: phys169
Date: Thu, 06 Aug 1992 23:25
33 lines
2432 bytes
In article <oeU4aRy00WB54AakI=@andrew.cmu.edu>, pr18+@andrew.cmu.edu (Paul Reber) writes:
> I'm trying to write some C code to communicate between two pc's over a
> null modem.  Using BIOS routines I have written a small sending
> program and a small receiving program.  Using Procomm, I have tested
> each -- the sender sends to Procomm, the receiver receives from
> Procomm.  Unfortunately, the sender will not send to the receiver.
> Looking at the status byte associated with the serial port, it appears
> that the sending program is hanging waiting for data-send-ready (or
> carrier-detect?).  Somehow Procomm avoids this.  How can I solve this
> problem?  Is there some handshaking that I'm missing?
> 
A "null modem" cable will normally have pin 2 going to 3 at the other end and
vica versa, PLUS 4 to 5 and 6&8 to 20, i.e. connect the "are you ready?" inputs
to the "I am ready" outputs.  So your program must set all the flags when you
start, either by int 0x14 calls or by outputting directly to the hardware
registers, although simply openning the "aux" file for output sometimes does
the job (not often when both ends use the same method).  If using BIOS, you've
probably already looked at Ralf's interrupt list and seen only some models
support ah=5.  If directly outputting to the hardware register...

  1. get the port base address from the word array starting at 0x40:0 (offset
     0 is for COM1, 2 for COM2, 4 for COM3, and 6 for COM4)
  2. at base port address+4 read present byte and write back this OR'ed with
     3 to set DTR and RTS when you are ready. Other bits should stay the
     same (the two "OUT" bits may or may not be important - OUT2 is sometimes
     required for interrupts to work properly).

When you get past that stage, there's all the problems of time-out in BIOS,
parity and data overruns to worry about!  You probably should consider
interrupt-driven assembler stuff that ignores BIOS, but you might be lucky.
Try praying a lot!

Mark Aitchison.
Technical Details
Message-ID: <1992Aug7.112508.211@csc.canterbury.ac.nz>
Path: arc1-ca.pugleaf.net!sparky!uunet!gumby!wupost!waikato.ac.nz!canterbury.ac.nz!phys169
References: <oeU4aRy00WB54AakI=@andrew.cmu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!gumby!wupost!waikato.ac.nz!canterbury.ac.nz!phys169
Newsgroups: comp.os.msdos.programmer
Subject: Re: Communicating over a null modem
Message-ID: <1992Aug7.112508.211@csc.canterbury.ac.nz>
From: phys169@csc.canterbury.ac.nz
Date: 7 Aug 92 11:25:08 +1200
References: <oeU4aRy00WB54AakI=@andrew.cmu.edu>
Organization: University of Canterbury, Christchurch, New Zealand
Lines: 33