Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.os.msdos.programmer FAQ part 3/5
Section - - How do I find the I/O address of a COM port?

( Part1 - Part2 - Part3 - Part4 - Part5 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Sex offenders ]


Top Document: comp.os.msdos.programmer FAQ part 3/5
Previous Document: - How do I set my machine up to use COM3 and COM4?
Next Document: - But aren't the COM ports always at I/O addresses 3F8, 2F8, 3E8, and 2E8?
See reader questions & answers on this topic! - Help others by sharing your knowledge

 Look in the four words beginning at 0040:0000 for COM1 through COM4.
 (The DEBUG command "D 40:0 L8" will do this. Remember that words are
 stored and displayed low byte first, so a word value of 03F8 will be
 displayed as F8 03.) If the value is zero, that COM port is not
 installed (or you've got an old BIOS; see <Q:06.01> [How do I set my
 machine up to use COM3 and COM4?]). If the value is nonzero, it is the
 I/O address of the transmit/receive register for the COM port.

 Each COM port occupies eight consecutive I/O addresses (though many
 chips use only the first seven).

 Here's some C code to find the I/O address:

   unsigned ptSel(unsigned comport)
   {
     unsigned io_addr;
  
     if (comport >= 1  &&  comport <= 4)
     {
       unsigned far *com_addr = (unsigned far *)0x00400000UL;
       io_addr = com_addr[comport-1];
     }
     else
       io_addr = 0;
  
     return io_addr;
   }

 You might also want to explore Port Finder, downloadable as:
 <http://www.simtel.net/pub/pd/47138.html>

 I haven't tried it myself, but a posted article reviewed it very
 favorably and said it also lets you swap ports around.

User Contributions:

1
Ben in Seattle
Jun 2, 2026 @ 4:16 pm
Another solution is to use a parallel port loopback plug. It makes the PC think there is a printer attached. The benefit of this is it doesn't require anticipating the problem with ANSI.SYS escape sequences nor does it make you wait half an hour for the "Abort, Retry, Ignore?" prompt, as some versions of DOS do.

Comment about this article, ask questions, or add new information about this topic:




Top Document: comp.os.msdos.programmer FAQ part 3/5
Previous Document: - How do I set my machine up to use COM3 and COM4?
Next Document: - But aren't the COM ports always at I/O addresses 3F8, 2F8, 3E8, and 2E8?

Part1 - Part2 - Part3 - Part4 - Part5 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
jeffrey@carlyle.org (Jeffrey Carlyle)





Last Update March 27 2014 @ 02:11 PM