Path: utzoo!attcan!uunet!cs.utexas.edu!sun-barr!ames!claris!sts!octopus!pete From: pete@octopus.UUCP (Pete Holzmann) Newsgroups: comp.sys.ibm.pc Subject: Re: COM ports - I am still confused!!! Summary: 0040:xxxx is correct for LPT ports, but wrong for COM ports! Message-ID: <645@octopus.UUCP> Date: 21 Jun 89 07:43:06 GMT References: <29697@ucbvax.BERKELEY.EDU> <6049@microsoft.UUCP> Reply-To: pete@octopus.COM (Pete Holzmann) Organization: Octopus Enterprises, Cupertino CA Lines: 37 In article <6049@microsoft.UUCP> philba@microsoft.UUCP (Phil Barrett) writes: >>(simon@ms.uky.edu) >>0040:0000 for COM1 >>... >The actual comm I/O port base address can be found at the >addresses 40:0, 40:2, 40:4 and 40:6 for com1 through com4, respectively. >This isn't a function of DOS but of the BIOS (and some drivers). This >scheme makes it easy for an application that directly manipulates the comm >device to be configuration independent. > >The printer ports are handled via similar scheme (lpt1 @ 40:8, lpt2 @ 40:A, >lpt3 @ 40:C and lpt4 @ 40:E). Unfortunately, while the above answer is correct regarding LPT ports, it is WRONG for COM ports. More specifically: LPT1 can be any of several I/O ports, depending on which hardware you have. DOS checks for 3 standard LPT addresses (3BC, 278 and 378, in that order), and fills in a table starting at 40:8 with whichever ports it finds. The port listed at 40:8 is LPT1, *always*. I.e., if you have 278 only, that will be LPT1. If you have 3BC and 278, 3BC will be LPT1. And so on. DOS checks for the normal COM1/COM2 addresses (2F8, 3F8) and fills in a table at 40:0. This is fine, but by universal common convention, the table is is not used to determine the address of COM1. COM1 is 3F8, COM2 is 2F8. There are a few software packages out there that try to "follow the rules" and use whatever is at 40:0 for COM1, etc. These packages are a pain in the neck for support people. It works fine as long as you have 1 com port set up as COM1, or two ports set up as COM1 and COM2. But if somebody has 1 com port set up as COM2, some software will simply choke. Too bad. -- Peter Holzmann, Octopus Enterprises |(if you're a techie Christian & are 19611 La Mar Ct., Cupertino, CA 95014 |interested in helping w/ the Great UUCP: {hpda,pyramid}!octopus!pete |Commission, email dsa-contact@octopus) DSA office ans mach=408/996-7746;Work (SLP) voice=408/985-7400,FAX=408/985-0859