This circuit uses a 16V8C GAL to do the head-scratching, and a 74ABT74 dual C-D flip-flop to do the timing. The circuitry and logic should be readily adaptable to other designs, whether powered by the 65C02 or the 65C816. If using this circuit with the 65C02, tie the VDA and VPA GAL inputs to Vcc or remove them from the logic equations. A 74AC74 is an acceptable substitute for the 'ABT74 if the clock rate isn't super-high (probably no more than 10-12 MHz).
Wait-State Generator Circuit
CUPL Code
Wait-State Simulation
In the simulation, an I/O address has been selected and becomes valid at vector 6. At vector 7, when Ø2 goes high the wait-state starts, and ends at vector 11. Note that when wait-stating is not required, pin 13 of the GAL is tri-stated. Despite this, isolation diode D1 is strongly recommended, just in case a logic error leaves pin 13 enabled and high when it isn't supposed to be active. In such a case and without the isolation diode, executing a WAI instruction will cause the MPU to attempt to sink pin 13. The resulting current flow will probably convert the MPU from a semiconductor to a full-time conductor.
—————
Edit: Omit diode D1. The GAL may not be able to sink the diode's cathode to a point that will produce the required voltage level on the MPU's RDY input.
