I've been reading the datasheet for the Z80 PIO chip a lot in the last few weeks, and I still don't fully understand what it's supposed to do. Take this diagram, from the Z80 CPU datasheet:
This is an example of how to use the Z80 CPU with the Z80 PIO and a ROM chip.
So, my understanding of the Z80 PIO is this:
- The CPU can send data to it so that it can send that data to perhipherals such as a keyboard.
- It can send data to the CPU from peripherals.
- It can also be used to control RAM chips.
Is any of this wrong?
Mainly, I'm confused as to exactly what the ports are. Do I attach one peripheral to each port? If this is the case, how would I control, say, three peripherals?
I'm also confused as to why A0 and A1 control B/A and C/D pins. Does this mean I would address a peripheral attached to port A with the address bus looking like: XXXXXXXXXXXXXXX0
? (Since then A0 is low?)
If my question's unclear, I'm looking for a clear explanation of what the PIO is for, and what exactly the ports mean, and what they're for.