MichaelM wrote:
Whenever I've looked at the specifications for the address change during Phi1, I've been left scratching my head as to the time reference for the event: the rising edge of Phi2, or some other internal timing reference. I've always been relatively unimpressed about the precision of the bus definition for both the 6502 and 6800, and it's because the exact timing reference of the address change is somewhat nebulous.
I think this is important generally and probably crucial here. Looking at the pins of the CPU, the falling edge of Phi2 is the only reference. At some point after the falling edge, the address lines will begin to change, and at some later point, they will stabilise at their new values. The timing of that will vary from one instruction to the next, and will also vary between address lines. There is no single instant when they change from the old bus value to the new bus value.
As a consequence, any decoder driven by the address lines is going to stay valid only for a little time after Phi2 falls, is liable to glitch as the various address lines change, and is going to become finally valid a little time after the address lines settle.
Any RAM, or writeable register, connected to the address bus, and a decoded chip select and write enable, could be responding to these changing addresses and changing chip select throughout the process. To avoid a stray write, we need to hold off any reaction until all the inputs are stable - and yet, the 6502 provides no timing reference for that moment.
It is common to use Phi2 again, or a version of it, for this purpose. So long as the half-cycle low period is long enough, and starts soon enough, it will correctly mask off the chip select and/or the write enable until both of them are valid.
In this particular case, I think we're interested in what happens at the beginning of a clock cycle, at nanosecond scale. Neither clock cycles nor clock phases are zoomed in enough to see what's happening.
We might be interested in a write cycle after a read, in a read cycle after a write, or even two write cycles back to back.
If the clock into the CPU is advanced relative to the rest of the circuit, then the address lines and RnW will be changing early, and if they are gated by a clock which is delayed, and if they change before that clock squashes the chip select and write enable, then a stray write could happen.
If the CPU clock is delayed relative to the rest of the circuit, it's more likely that the address lines and RnW are still stable at the point the chip select and write enable are deasserted. Whether that's successful depends on the relative speed of the CPU, among other things. A slow CPU - such as an NMOS part - might be unable to move the signals too soon, and so be safe. It might even be safe with no delay. A faster CPU - such as a modern CMOS part - might need more delay because it moves the signals sooner.
The hazard of delaying the CPU clock is that the CPU will capture data on a read cycle somewhat later, so it's important that devices writing to the bus (RAM, ROM, peripherals) don't move the datalines before the CPU is done: the CPU needs to see the falling edge of the clock and then the hold time needs to elapse. Fortunately, an undriven bus won't move terribly fast, so this is less likely to cause a problem, provided the output drivers of the driving devices are disabled.