Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find the parallel port

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I need to write code in assembly to find the parallel port.
Any help?
 
Define 'find.'

Find if one's present? Two?

Find their IRQ's? their IOPorts? "Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
 
hello,

parallel port stuff!

call to get the parallel port confuguration into AX
no pre-reqs required

int 11h
returns: ax=all PC configuration
bits 14&15 of register ax indicate how many parrallel ports installed.

following BIOS calls do printing but bi-directional comms info follows

read printer status
mov ah=02h
mov dx=parallel port number (LPT1=0)
int 017h
returns: ah=printer status

initialise printer
mov ah=01h
mov dx=parallel port number (LPT1=0)
int 017h
returns: ah=print status

write character:
mov ah=0h
mov al=charactor code
mov dx=parallel port num (LPT1=0) etc
int 017h
returns: ah=printer status


print status bits
-----------------
bits of ah
0:timed out
1:unused
2:unused
3:1=ERROR transfer error
4:0=SLCT printer offline
5:1=PE out of paper
6:1=ACK receive mode selected
7:0=BUSY printer busy

bi-di comms
-----------
you cannot use dos,bios or memmory mapped ports as this access is too slow and using the io port directly stops the processor caching (read before write not wanted).

make up a cable crossing the following pins

2 to 15
3 to 13
4 to 12
5 to 10
6 to 11

you are connecting D0 to ERROR, D1 to SLCT, D2 to PE, D3 to ACK and D4 to BUSY.

This will allow you to send the five data bits from one PC to the printer status of the other.

You can send four bits at a time using the fifth as a control bit!

the first parallel port addresses are 0378h,0379h,037Ah

0378h is a data byte (D0-D7) sent - write only
0379h is printer status - read only
037Ah is printer control - read/write

to write to port from al use
out 0378h,al

to read from port to al use
in 0379h,al

this should be enough. ask any Qs cos i know my xplans are not the best.
straiph
0000:0000:0000:0000h
The people who have nothing to say and say it too loud have little knowledge, It's the quiet ones you need to worry about!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top