I've successfully created phi2 clock pulses synced to the 1.5 MHz phi0 clock on the PCB! This hopefully opens up access to hardware that uses clocks derived from the master clock on the PCB instead of the phi1/phi2 outputs from the 6502, without having to use the ICT's clock master mode (which kills real-time operation of the hardware.)
Thanks to a fortunate relationship between the 1.5 MHz clock of the CPU and the 16 MHz clock of the AVR/ATmega on the Arduino, I can get surprisingly accurate timing. It turns out that 11 AVR clocks take ever-so-slightly longer than one 6502 clock (20 nanoseconds).
If I use polling to get an approximate position somewhere in the low part of the 6502 clock cycle, I can then use an 11-cycle loop to look for the start of a high pulse. Each time it loops, it gets 20ns closer to the rising edge. When it finally hits it, I know the next one will come in about 10 cycles, so I time my phi2 pulse to occur at that time.
What little assembly coding I did was over 30 years ago, but I managed to cobble together a series of instructions that actually works!
Here are the clock signals with a real 6502A (phi0 input on bottom, phi2 output on top):
Here are the same signals using the ICT:
It really is accurate to about 20ns -- this slight jitter makes phi0 look a little fuzzier with the ICT. It's much tighter than I expected to get, though, and should be more than sufficient.
Now I need to try using it to access the Battlezone mathbox and vector generator, which didn't play well with the ICT before. Centipede video RAM will require a somewhat different strategy, since phi0 skips pulses to avoid contention with the display hardware, but I think it can be adapted.
I'm not sure how to turn this into proper code yet. Getting this sort of speed and timing requires hard-coding for specific pins/ports, instead of using the structures that abstract this away from the main code. Maybe it doesn't really fit, and will have to remain experimental. I guess I'll worry about making it useful first...
Anyway, thanks for listening!