[net.micro.pc] Line Printer Interrupts

ROGERS%USC-ISIB@sri-unix.UUCP (01/18/84)

From:  Craig Milo Rogers  <ROGERS@USC-ISIB>

	For the diehard bit-shovelers out there, here are some
observations I've made on the design of the interrupt interface
in the IBM-PC line printer interface.  These comments are part
of the interrupt-driven code in <INFO-IBMPC.INT> on ISIB.
Has anyone else out there analyzed the line printer interface
in detail?  Did you reach the same conclusions I did?

					Craig Milo Rogers
			--------

;	This is a module of routines for interfacing with the
; LPT1: communications interface on the IBM PC.  The code has
; been carefully constructed to properly drive the printer interface
; and the 8259 Interrupt Controller.  Internal circular buffers
; are used for transmit and receive.

;	Only one LPT: is supported at present.  A unit number is
; included in all calls so multiple-printer support may be added in
; the future.

;	The LPT: interrupt source is the -ACKNOWLEGE signal from
; the printer.  In the case of the Epson MX and FX printers, -ACKNOWLEGE
; goes active (low) for 5 usec when a character has been processed,
; then returns to inactive (high).  Since the -ACKNOWLEGE signal is
; inverted by the printer interface card before it is presented to
; the IRQ7 line on the IBM-PC's bus, it is the high-to-low transition
; of -ACKNOWLEGE which causes the low-to-high transition of IRQ7, which
; in turn triggers the interrupt sequence in the 8259.  This, in turn,
; triggers an interrupt sequence in the 8088 processor.
;
;	Thus, it is the high-to-low transition of -ACKNOWLEGE which
; starts the interrupt sequence.  However, since -ACKNOWLEGE is low
; for only 5 usec, it may have returned to its high state before the
; 8088 sends INTA to the 8259 to acknowlege the interrupt.  This is
; a violation of the 8259 specification.  The 8259 will then generate
; a "DEFAULT" interrupt request cycle, instead of a normal IR7 cycle.
; However, since the DEFAULT cycle just happens to be IR7, too, it
; all works out OK.
;
;	The 8259's restriction on IRn pulse length is intended to
; catch static on the IRn lines, and/or malfunctioning devices.
; It is entirely possible that a DEFAULT IR7 may be generated for
; some reason other than the line printer.  The line printer interrupt
; routine attempts to protect against this case by checking the
; BUSY bit in the interface.  Everything would probably work a lot
; better if the line printer interface fed the -ACKNOWLEGE signal
; directly to IR7, instead of inverting it first.

-------