The 82C55A is a high performance CMOS version of the industry standard 8255A . It is a general purpose programmable I/O device which may be used with many different microprocessors. There are 24 I/O pins which may be individually programmed in 2 groups of 12 and used in 3 major modes of operation. The high performance and industry standard configuration of the 82C55A make it compatible with the 80C86, 80C88 and other microprocessors. Static CMOS circuit design ensures low operating power. TTL compatibility over the full military temperature range and bus hold circuitry eliminate the need for pull-up resistors.
[From: HARRIS Semiconductor, data sheet on 82C55A (same from local server)]
Figure 11: Block diagram of a 82C55A
To switch between 'RAM-' and 'ROM-mode' the 8255 has a mode register where three working modes can be selected. The mode register is selected when A0 and A1 are set to high (+5V).
The three modes are:
Mode 0: basic input / output
Mode 1: strobed input / output
Mode 2: bi-directional bus
Figure 11a: The control word for port definition
For our purpose only mode 0 was interesting, but
the device may be switched into each with the setup supplied in this
To work with the three ports they must first be initialized. This is done by writing the proper control word into the control register. Figure 11a shows the definition of the control word. While bit D2, D5, D6 and D7 define mode 0..2 the bits D0, D1, D3 and D4 define the settings of the ports to input- or output-mode. In other words you need to 'program' or switch the 82C55 every time you want to change a port data flow direction.
If 'all input mode' in mode 0 is requested the control word would be 10011011bin = 9Bhex = 155dec. If 'all output mode' in mode 0 shall be selected the control word would be 10000000bin = 80hex = 128dec.
For further information on the 82C55A and it's capabilities see the PDF-document (on local server).