The diagram above shows a simplified version of the logic that comprises a bi-directional port pin. I/O pins, typically in groups of eight, comprise a single port.
All ports have a data register that holds the value written to or read from the port. Bi-directional ports share a single data register that, when read, returns the state of any pins configured as inputs and, when written, drives pins configured as outputs to their specified states. A data direction register specifies whether each pin associated with a bi-directional port is an input or an output. All bi-directional pins are preconfigured as inputs during and immediately after RESET assertion.
Many 68HC05 devices have mask programmable pulldown or pullup devices that keep pins configured as inputs in a known state. Integrated pulldown or pullup devices generally eliminate the need for similar external components and, in turn, help reduce current consumption by preventing CMOS input devices from "floating" at indeterminate levels.
On 68HC05 devices with UV-erasable or one-time programmable EPROM, integrated pulldown or pullup devices are controlled by a mask option register that is programmed in the same fashion as the main EPROM array.