The first thing the I/O unit needs to do, is to see what the printer is doing at the moment. The program which requested the print has long gone and has no idea whether the printer is able to print, or even if there is a printer! Nor does it care - its up to the I/O unit to sort it out.
The I/O unit sends a request for status from the printer, by activating a request line on the Output cable. The data field, or data lines will identify this as a request for status. Assuming there is a printer there, and it is powered on (it could be powered off for maintenance), the received signals will activate a reply, based on the printer status.
Maybe the printer is out of paper, or the operator is replacing the ribbon. Most of the time the printer will be either sitting idle waiting for a job, or printing a previous job, which the I/O unit is handling. The printer logic will identify this status, because certain flip-flops will be set as it goes through its operations. These conditions are gated to the Input cable by the Request and Status Command lines received from the I/O unit.
For example a switch on the printer will activate when the paper runs out. This will set a flip flop 'Paper Out'. A signal generated from the 'Status Request' signal received from the I/O unit will enable the 'Paper Out' signal to be gated to the Input data cable as one of the 'data bits'. The status is passed to the I/O unit, triggered by an input request, generated from the original Status Request.
The 'Paper Out' bit, along with any other status bits will be gated to a status register, where it can be examined by the CPU. A message from the Operating System may be sent to the System Operator informing him of the status, if it requires operator intervention.
Assuming all is well at the printer, we can begin to send the data. A typical line printer prints 160 columns across the page, so we will need to transfer 160 data characters. Depending on the word size in this system we will transfer the first 4, for example, to the buffer register in the printer. The control signals handle the request, and gate the data to the Output cable. A similar logic process in the printer gates these 4 characters to their correct position in the buffer. As the buffer is not yet full, a further 4 characters are requested. The I/O, having updated its data count and address registers, sends the next 4.
This process continues until the print buffer is full, representing one line of print. The print command is given, and the print hammers strike the ribbon against the paper as the correct character passes under the hammer. On a drum printer, for example, the characters are arranged on the drum in staggered rows of 160 of each character. When a row of 'A' is under the hammers, a hammer is triggered wherever an 'A' character appears in the corresponding print buffer. One revolution of the drum allows the complete row to be printed.
The paper is moved along one row space and the next row can be printed. While the paper is being moved, the next row of characters to be printed is transferred. There is plenty of time for this to occur, as the data is transferred electronically, in microseconds, while the paper is moved mechanically, in milliseconds, (one millisecond = 1000 microseconds).
When this print job is complete, the I/O's buffer counts go to zero, and it notifies the operating system that it has completed the job. This is done by sending an interrupt to the OS with a status word in the reserved area showing job completed satisfactorily. If there was a problem with the job the I/O writes the status, obtained from the printer in the status word it passes to the OS.
The OS can now allocate the next print job to the printer as before, the handshaking keeps everybody informed as to what is happening, and what is required to happen next.
Tony is an experienced computer engineer. He is currently webmaster and contributor to http://www.what-why-wisdom.com A set of diagrams accompanying these articles may be seen at http://www.what-why-wisdom.com/history-of-the-computer-0.html RSS feed also available - use http://www.what-why-wisdom.com/Educational.xml