IBM-PC Parallel Printer Port
Finding out how many ports are present and where

Normally, a PC can have up to 3 parallel printer ports - LPT1, LPT2 & LPT3. Their (16-bit) base addresses in the processor's I/O space are loaded into memory when the machine is booted, starting at address 408 Hex.

A well-written program requiring direct access to any of these ports should endeavour to find out which are present and where at run-time (rather than use constant declarations as in my earlier examples!)

Due to 80x86 processors being " little-endian", the addresses are stored as follows -

408 409 40a 40b 40c 40d
LPT1 LPT2 LPT3
low
byte
high
byte
low
byte
high
byte
low
byte
high
byte

For example, the following values -

408 409 40a 40b 40c 40d
78 03 78 02 00 00

mean that LPT1 is at 378 Hex, LPT2 is at 278 Hex, and LPT3 is not present.



[ Previous ] [ Index ]


last updated: 18-Apr-97 Ian Harries <ih@doc.ic.ac.uk>