COM3COM4

COM3COM4.DOC:

Tips on Using COM3 and COM4 Serial Ports

Part I - Port Address Problems

Part II - Converting the IBM Asynchronous Communications
          Adapter to use as COM3 or COM4


Part I - Port Address Problems

SETCOM3 - Set base address of COM3 serial port

          Al Stangenberger
          Dept. of Forestry & Resource Mgt.
          University of California
          Berkeley, CA  94720

          (forags@violet.berkeley.edu)

This discussion and program is adapted from the MS-Kermit User Guide.

Some programs trying to use serial ports COM3 or COM4 will not
run because the base addresses of these serial ports are not
stored in the proper low-memory addresses.  There are no
standards for the values for these addresses (unlike for COM1 and COM2),
hence they may not be in the system ROM Bios boot code which is run
when the computer is turned on.

This condition may easily be confirmed by attempting to use the
MS-DOS MODE command to set parameters for COM3 or COM4.  If an otherwise
valid MODE command returns diagnostics such as "Illegal device" or
"Invalid parameters," then these addresses have not been defined yet.

The code in SETCOM3.RAW is a prototype of input to DEBUG
which can be used to construct a small .COM program to
correct this problem for serial port COM3.  A slight
modification would make it suitable for COM4.  Normally,
SETCOM3 is only executed once as part of the AUTOEXEC.BAT
procedure.

To adapt SETCOM3.RAW to your situation, consult the
documentation for your serial card or modem to find the base
address used when the card or modem is set for COM3.
A typical value would be 02E8 (hexadecimal).
Modify lines 4 and 5 in SETCOM3.RAW to have this value.

To construct the program, type the command:

A> DEBUG < SETCOM3.RAW

It's a good idea to use DEBUG to examine the result to be
sure it is correct.  To do this:

A> DEBUG setcom3.com
-u
     (the assembled code will be listed here)
-q

The program is executed by the command

A> SETCOM3


To change from COM3 to COM4, find the base address for COM4 as
described above, and change lines 4 and 5 accordingly.
Also change line 7 from [4] to [6] to store this address at the
proper location in memory.  Finally, change the name of the file
written (line 12) to SETCOM4.COM for clarity.

Following is a commented version of SETCOM3.RAW:

Line #  Instruction    Comment
------  ------------   -----------------------------
 1      a              Assemble command (to DEBUG)
 2      mov ax,40      value 40H
 3      mov es,ax      put in register es
 4      mov ah,02      02 part of 02E8H
 5      mov al,e8      E8 part of address
 6      es:
 7      mov [4],ax     store in 40:4 for com3 (change to [6] for COM4)
 8      int 20         return to DOS
 9                     blank line ends assemble mode
10      r cx           Show contents of register cx
11      0f             Set cx to write 0fh bytes
12      n setcom3.com  name file setcom3.com
13      w              write the file
14      q              quit debug

Following is an un-commented version of SETCOM3.RAW.  Use a
text editor to alter it as needed, and write it to a
separate file (SETCOM3.RAW) for use as input to DEBUG.

------------------------------- cut here -------------------
a
mov ax,40
mov es,ax
mov ah,02
mov al,e8
es:
mov [4],ax
int 20

r cx
0f
n setcom3.com
w
q


------------------------------- cut here -------------------


Part II - Converting the IBM Asynchronous Communications
          Adapter to use as COM3 or COM4


From: uw-beaver!tektronix!tekgen!ferrouss (Ferrous Steinka)
Newsgroups: comp.sys.ibm.pc
Subject: Serial ports 3 and 4
Date: 25 Mar 88 17:55:48 GMT

So, you've upgraded to a multifunction card and you have an old
IBM asynchronous communications adapter laying around that is
just taking up space.  Well, with a simple mod to the board, it
can be made to respond to COM3 or COM4.  Of course you will need
to have appropriate software to take advantage of your new serial
port. IBM MSDOS 3.3 knows about ports 3 and 4, MSDOS 3.1 doesn't
and I'm not sure about 3.2 or 3.21. I tested ProComm and it DOES
know about the secondary ports.  The addresses of COM1 and COM2
are 3F8(h) and 2F8(h) respectively.  The addresses for COM3 and
COM4 are 3E8(h) and 2E8(h) respectively. The difference is address
line A4, and all you have to do is invert it on the board prior to
the decoding logic. This can be done by cutting pin 5 of U-2, a
74LS30, at the surface of the board and gently bending it up so
that it may be soldered to.  The pad to which pin 5 of U-2 was
soldered is A4, which connects via the edge card connector to the
system bus. Pin 5 of U-2 is an input to the decoding circuitry. I
chose to use a 74LS04 as the inverter (piggy-backed onto U-3, also
a 74LS04, to provide power and mechanical stability) . Connect pin
3 of the tacked on 74LS04 to A4 and pin 4 of the 74LS04 to pin 5 of
U-2.  CAUTION: There are unused buffer/inverters on the board but
they are open collector type devices.  Using these could lead to
timing problems.

For additional information, consult an IBM Technical Reference
Guide for either the PC or the XT.  Both have schematics of the
asynchronous communications adapter.