[alt.msdos.programmer] Programming the Parallel Printer Port

fredex@wizvax.UUCP (Fred Smith) (06/04/90)

I am attempting, for various reasons too boring to discuss here to figure out
how to program the parallel printer port on my XT clone in such a way as to 
be able to drive the printer via interrupts. I have exhausted my knowledge
(as well as a good bit of guesswork) of how to do this to no avail. It is my
sincere hope that there is some kind person out there in news-land who knows
how to do this (or who knows more than I, anyhow) and who will be willing to
pass the information on to me.

I know that many older parallel ports are reputed to not generate interrupts
reliably, but I have reason to believe that mine does work properly. It is
the printer port built into the Taiwanese clone Hercules graphics card I have,
and I have a shareware print spooler that can use interrupts which works just
peachy with LPT1 (the clone Herc card), while failing miserably with LPT2
(the multifunction card in the machine). I must mention that both ports also
work fine when interrupts are NOT enabled by the spooler.

Now, here is how I am trying to program the sucker:

1: read from the printer control port the current settings.
2: read from port 0x21 the current setting of the 8259 programmable
   interrupt controller.
3: mask off the bit that enables interrupts (it should already be off)
   to ensure that it won't try to interrupt me while I am swapping vectors,
   and write this value back to the printer control port.
4: get (from DOS) the current vector for INT0Fh
5: install the vector for the new (my) interrupt service routine.
6: send a reset to the printer port
7: mask off the high-order bit (bit 7) of the value read in step 2 and
   write it back to the PIC. This should allow IRQ7 to interrupt the 
   processor chip.
8: enable interrupts on the printer port by taking the value read in step
   1 , ORing it with 0x10, and writing it back to the printer control port.

Now, having done this no interrupts occur. I have put a counter into the
ISR which increments when it is called and it does not change. I have tried
"priming the pump", so to speak, by blasting a character to the printer
data port as the last step in the process followed by strobing the sucker.
I have tried taking the printer off and back on-line. None of this works.
I am left to the conclusion that I have overlooked something important.
All help would be appreciated!

Please reply by e-mail, not by replying, as my site does not receive some
of the groups to which this is posted.

Fred Smith

uunet!samsung!wizvax!fredex