Fig. 18.1.1 shows in a very general way how I/O ports connect to peripherals. Usually ports connect to internal buses which feed the input and output wires of the accumulator.
Fig. 18.1.1: Connections between the CPU and the ports, and ultimately to the peripherals