As Garth said, CA1 is only an input to the computer, while CA2 can be configured as a kind of input or output. You can't assign one to "data ready" and one to "data available" and have it work in both directions - the pins' roles must swap when the data direction changes. It will require some coordination and agreement between the devices if you want to change the direction in the middle of communication.
The basic operation is very simple - when your computer is transmitting data to your peripheral, the VIA will send a pulse or handshake on CA2 after you write data to port A - I believe this happens as soon as PHI2 falls. And you get an interrupt if the peripheral signals you via CA1, so you know you can send the next byte of data. For handshake mode, the VIA keeps CA2 low until it sees that response on CA1; in pulse mode it's just low for one clock cycle I think, so for that mode your peripheral needs to respond to the edge of the signal, e.g. via an interrupt, rather than polling its level. I too have only used pulse mode personally.
When you're reading data, the peripheral will need to set up the data it's sending, then send a signal on CA1 so that your computer will get an interrupt and know data is available, and the CPU will then read the data from the port, and the VIA will automatically send a pulse or handshake on CA2 to let the peripheral know the computer read the data. Again, the handshake is like the pulse but is held low until the VIA sees a response on CA1; and again I've only used pulse modes myself so don't speak first-hand about how handshaking mode works.
So what the VIA is doing is very simple, and is essentially the same in both cases - when data is read or written, it initiates a pulse or handshake; and if it's a handshake, it is cleared when it sees the response on CA1. Either way, you'll also configure CA1 to generate interrupts, and that's how the CPU knows when it is time to read or write the next byte of data.
On specific points from your last post:
Computer triggers and interrupt on the AVR (using the 6522)
It's not clear to me what you mean by this, is it happening through some other means that what we're discussing here, e.g. an output pin on port B?
MCU responds by putting 0x06 (ack) on PORTA of the VIA. After writing to PORTA, MCU asserts DATA READY on CA2, CPU does NOT check CA2 here. Relevant?
As noted, the MCU needs to send an edge on CA1 if it wants to interrupt the computer - not CA2. The CPU cannot really "check" either CA1 or CA2, there is no facility for that in the VIA - the only way to "read" these pins is to notice interrupts are pending.
I'd also avoid thinking of it in terms of "DATA READY" and "DATA TAKEN", due to the different meanings for reads and writes, but instead think of CA2 as "CPU READY" and edges on CA1 meaning "MCU READY". The VIA sets CA2 low when the CPU is ready for the MCU to read or write its next byte; and the MCU sends an edge on CA1 when it is ready for the CPU to do the same.
CPU loops until it reads 0x06 from VIA PORTA
So usually it would just get an interrupt, determine it was from CA1 on the VIA, and read the data. If you do want to poll though then I think you can read the IFR from the VIA in your loop and wait for the CA1 bit to get set. This tells you an edge was seen, not how many edges or what the current level of CA1 is.
You certainly don't want to sit looping reading port A looking for a specific value while in handshaking mode - every read will cause a signal to be sent to the microcontroller. Try to execute only one read to consume the byte, and then the microcontroller will get correctly notified that you read the data.
MCU loops until it sees DATA TAKEN on CA2 . (scope confirms CA2 toggles)
Yes this should be sent automatically if you've configured the VIA correctly.
Ok, here's where things seem to derail. At this point, I'm trying to send the code '0' from the CPU to the MCU to relay that "DIR" has been typed
You need the MCU and computer to both know that they're switching communication direction and you need to be quite careful. Normally after the CPU reads a byte, the MCU would see the CA2 pulse and send the next byte, including signalling via CA1 that this had happened. But there is no next byte, so there will be no CA1 signal. In handshaking mode, CA2 will stay low. The MCU also can't just try to read a byte straight away as the low state on CA2 is only signifying that the CPU has read the previous byte - not that it has sent the next one.
I think the MCU ought to send an extra pulse on CA1 to clear the CA2 state, and the CPU needs to wait for this extra interrupt before sending its first data byte. Then the MCU can wait for CA2 to fall again, before reading the first byte sent by the CPU, and send CA1 pulses after reading the byte; so if there are more bytes to send the CPU can keep doing so each time it receives an interrupt from the MCU via CA1.
This only covers transitioning from CPU reading to CPU writing - I think you need to also think carefully about how the opposite transition would take place.
The MCU loops, waiting for DATA READY to be asserted on CA2. When it gets this, DDRA on MCU is set to all inputs.
CPU sets DDRA on VIA to all outputs. This signal never happens. (per my scope)
I write "0" to VIA PORTA. I never see the CA2 line asserted by the VIA signifying I wrote this data to the VIA. My loop hangs.
Amy thoughts?
I think it would help to see the 6502 code you're using here.