GARTHWILSON wrote:
Very important: The 6502's cycle starts with the falling clock edge, then the processor sets up the address and R/W, well ahead of the rising edge of Φ2. Whether reading or writing, the data must be valid before the
fall of Φ2 at the end of the cycle, with enough setup time for the data to be latched in at the falling edge. The timing diagrams in the data sheets have all the details.
One cycle:
Code:
_________
\________/ \
Thanks. I have taken a look at a couple datasheets, both for the 6502 and for RAM and ROM. So this is what I've come up with, attached is the updated diagram.
In my particular implementation control signals (including R/W) change on the falling edge of Φ2, and data is latched on the rising edge.
The write cycle starts at point D, on the falling edge of Φ2. Addresses have been set on the preceding rising edge, so they should be valid by this point. R/W changes shortly after, so does the data, which is valid through E and to the falling edge of Φ2 in F, when it's latched by for example RAM.
The read cycle starts in A, with valid addresses and data set beforehand. The difference here is that data is read by the CPU on the rising edge of Φ2, on B instead of C. It has to be this way, as I'm latching data on the rising edge.
I suppose this would work, there would be plenty of setup time, unless the peripheral waits to the rising edge of Φ2 to output the data that is.
Juan