HOW A PHYSICAL COMMUNICATION PORT IS ASSOCIATED WITH A DOS COMn DEVICE DOS PCs come with full support for two communication ports, COM1 and COM2, and with provisions for two more, COM3 and COM4. COM3 and COM4 are not well (or consistently) supported in most types of PCs, as are COM1 and COM2 which rarely (by themselves) cause any problems. This discussion considers only COM1-COM4, since higher-numbered COM ports are rare, and in any case not supported by MS-DOS Kermit. The digit in the port name (like the "2" in COM2) is an index into an area in memory that contains the address of the serial port hardware. The PC's Basic Input/Ouput System (BIOS) has four words starting at segment 40 (hexadecimal), word 0, for the addresses of the first four COM ports. Word 0 is for COM1, word 2 (two bytes per word) for COM2, word 4 COM3, and word 6 COM4. To view these addresses: C:\> debug (start the debug program) -d 40:0 (display segment 40) -q (quit the debug program) ("C:\>" is the DOS prompt, "-" is the debug prompt.) Here are the results on a PS/2 with 3 COM ports: 0040:0000 F8 03 F8 02 20 32 00 00-BC 03 00 00 00 00 60 03 .... 2........`. ^^^^^ ^^^^^ ^^^^^ ^^^^^ COM1 COM2 COM3 COM4 The first line (like the one above) contains the COM port information (ignore the other lines, as well as the characters on the right). "F8 03" is the 2-byte COM1 address, expressed in hexadecimal (base 16) with the low byte first. Thus the actual COM1 address is 03F8 hex, expressed in Kermit commands as \x3f8. The COM2 address is 02F8, the COM3 address is 3220, and (since there is no COM4) the COM4 address is 0000. That is how both DOS and the BIOS understand which ports are defined and where to find them. When your PC is powered up, the BIOS startup code checks for serial port hardware (that is, a Universal Asynchronous Receiver/Transmitter, or UART) at the two port addresses 03F8 and 02F8. If it finds a UART at the first address then that address is placed in word 40:0 and declared to be COM1. Then the BIOS tries the second address and if successful this address goes into the first available word at that time, typically 40:2 as the address of COM2. Thus if you remove a COM1 device then a previously COM2 device will appear in the COM1 BIOS storage area as COM1 to DOS and Kermit. What happens to the other two words depends on the PC model and BIOS. The IBM PS/2 BIOS fills in all four words on startup, but most others handle only the first two because that's how IBM did it with the original PCs. So... just setting switches or jumpers on a serial port board or internal modem does NOT necessarily define the board to be a particular COM port. So why do some communication programs work with COM3 and COM4 without any special fiddling? These programs ASSUME certain COM3 and COM4 addresses, even when there are no entries in the BIOS communication-port area. Some of these programs show you their assumptions in a menu (and might allow you to change them), others do not. The assumed values are usually as follows: Port Assumed Address (hexadecimal) COM1 03F8 COM2 02F8 COM3 03E8 COM4 02E8 NOTE: PS/2s use different addresses for COM3 and COM4 -- 3220 and 3228, respectively. Well-behaved communication software (like Kermit) will use these addresses rather than the defaults listed above. Ill-behaved software ignores the segment-40 addresses and erroneously attempt to use its own values, right or wrong. Unchecked use of an assumed port address is DANGEROUS if the device is not really where the software expects, especially if some other kind of device, say a network adapter, is at the given address. It can also produce unwanted conflicts under Windows, OS/2, and DesqView, whose drivers often set the port's segment-40 word to 0 when they want to use the port exclusively and without interference, and then restore the real address when done, and similar unwanted interference with Int 14H redirectors that allow serial-port communication software to be used on network connections. Unlike most other PC communication software, Kermit does NOT attempt to use a communications port unless: (a) It finds its address in the BIOS comm-port area, segment 40, or: (b) You specify the address yourself. AND: The device at the given address passes certain tests, in which registers must contain certain values that are legitimate for a UART. In other words, KERMIT IS MORE CAREFUL than most other communication software, because does not want to risk disrupting normal operation of your PC. .