Handshake
The handshake is a device designed to facilitate communication with Centronics printers. It is based on Intel's PPI 8255 in "mode 1", but with some modifications to simplify its operation.
It has two 8-bit registers:
- the data register (address
40h
in the I/O memory), - and the status register (address
41h
in the I/O memory).
Specifically,
Data = DDDD DDDD
Status = I___ __SB
The character to be printed, expressed in ASCII, will be stored in the data register. Each time the CPU writes to this register, the handshake will generate a rising edge on the strobe to automatically print the character.
In the status register, the two least significant bits are the strobe and busy (read more about them), analogous to how they are used in a printer connected with a PIO. The difference is that the busy bit cannot be modified by the CPU and the strobe bit is always 0
. If the CPU tries to write a 1
to the strobe bit, this will cause a rising edge on the strobe, sending what is stored in the data register, and the handshake will automatically return it to 0
.
Additionally, the most significant bit of the status register enables/disables interrupts. If this bit is 1
, while the printer is not busy (B=0
), the Handshake will trigger a hardware interrupt. It is connected to the INT2
port of the PIC.