Link to home
Start Free TrialLog in
Avatar of ThomasHolz
ThomasHolz

asked on

Who is LPT1?

By default LPT1 seems to be mapped to port 0x378. But the user can change this. How do you detect which port is behind LPT1? (LPT2/LPT3?)

Under DOS it seems you can get a list from memory location 0x40..0x4F. But I didn't find a way to do this under Windows (NT/2K/XP, if possible also 98/ME).

Does anybody know how to detect this?

Thanks,

Thomas
Avatar of Callandor
Callandor
Flag of United States of America image

Look in device manager at Ports(COM & LPT).  You will see the I/O address in the Resources tab for LPT1.
Avatar of ThomasHolz
ThomasHolz

ASKER

Sorry, the question was a bit unclear: I want my program to do this.

So, how can I do this programmatically?
Not exactly a question for Hardware experts, is it?  ;-)

How about this site: http://www.vcomsoft.com/infopage/LPTPORT.html
Yes, the question is a bit of everything. Hardware, Windows, C++...

The VCOMSOFT library doesn't seem to contain the detection, it just mentions where the BIOS lpt info is stored. But I'm not sure if that really is any good. (Apart from the fact that it's difficult to access it from Windows NT & Co.)

On my PC I get this:
> debug
> -d 40:0
> 0040:0000  F8 03 F8 02 E8 03 E8 02-BC 03 78 03 78 02 C0 9F

According to the website "0x408 0040:0008   LPT1 BASE ADDRESS" my LP1 should be 0x3BC. But if I look into the Windows device manager it tells me that LPT1 uses 0x378-03x7F.

Isn't there a way to query the info from the device manager? I've already searched the registry and found some info but not the info that I need...
In old skool DOS you had to copy text.txt lpt1: to print it out.  Does it still work like this in C++?
It seems that the 0x3BC is a carryover from the old days when parallel ports were included on video cards.  This site explains some of that: http://www.beyondlogic.org/spp/parallel.htm#4  However, the existence of 0x3BC in location 0408 is puzzling.
just a quick question...   is LPT1 related to C3PO ?    


@JimsZ
By now I suspect that it's his evil twin brother.

@Callandor
My guess is, that 0x408 contains the BIOS defaults, but that Windows may override them with its own (user-defined) values. So the question, how to detect these values, remains.
(Points increased to 400)
Perhaps you want to post a 20-pt link question in the C++ TA to this question and get some ideas from those experts?
I'll give it a try.
This might be of use. Its a whole bunch of reference material about where to find what in the DOS world.

http://members.tripod.com/~oldboard/assembly/bios_data_area.html

Paul
So why do you want to know where LPT1 is?

Under Windows NT/2000/XP you usually use the device driver, so you never need the I/O port address.

 
Aren't these ports (LPT and COM) hardware ports, so to speak? They do have an actual physical I/O address, sometimes possible to change from the BIOS setup program within the possibilities for each port (like, there are 3 locations for the parallel ports, 4 for COM ports and you can change the present ports around a bit). Using I/O ports that are "not there" from windows applications may be depending on the possibilities of the HAL to map the ports to addresses not really used by the hardware as such. Sounds like you have to manipulate the HAL or something to move the port around.

/RID
@Paul:
The memeory method doesn't get correct on my PC (see above), so I don't really trust it...

@grg99:
I just want to get the name to make a configuration dialog easier. In fact, accessing the port is already solved.

@rid:
Sounds good. But how do I do that? I can't find the right windows command. I tried EnumPorts which gives me a nice list of port names - but without the port addresses.
What I meant was:
If your system comprises one physical parallel port at I/O h378, the BIOS will find that port, as part of the POST routine, because it looks for a port on that address. The operating system may call this port anything, but DOS/windows use LPT1 for the first parallel port. "LPT 1" is not necessarily coupled to a physical address, because if the system's (only) parallel port happened to be located at h278 instead, BIOS would find it and then the O/S would in all probablility label it LPT 1 because it is the first (and only) parallel port it can find, disregarding the fact that h278 is the second location BIOS will look into for a parallel port.

I am just supposing (sorry!) that the HAL of modern windows systems can re-map physical I/O addresses to something else from an application's point of view, that is; I don't think even windows can reconfigure a hard-coded circuit and change the physical address. How (and why) changing the LPT 1 port I/O address should be done is beyond me.
Regards
/RID
ASKER CERTIFIED SOLUTION
Avatar of Posit
Posit

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial