ZX-TURBO

A ZX81 Clock Doubler

05/2005 - wilf rigter

 

       

Why couldn't Sir Clive have added a turbo charger when he evolved the ZX80 into the ZX81. Slow mode video is nice but results slow speed of user program execution at 1/6 of the speed of the ZX80 or speed of the ZX81 Fast mode.  The reason is that the CPU is multitasking between the video routines and the user program and spends 5/6 of the available CPU time generating the video display. The CPU is tightly coupled to the video circuit and this requires real time processing by the CPU which make the video routines execution time critical. There are several ways in which to speed up user programs but all involve some tradeoff. What about simply increasing the CPU clock speed?

 

The original Z80 was a 4MHz unit and faster clock versions were not common at the time. Now 6MHz and faster CMOS Z80s are readily available but there remains the problem of the time dependent video routines. If the CPU were switched to a higher clock source only when the user program is being executed and then switch back to normal speed when the video routines are active, the problem could be solved.

 

Kevin Baker designed just such a circuit in 1996. His 8 chip ZX81 Clock Doubler circuit dynamically switches between two CPU clock frequencies so that program execution in the SLOW mode is two times faster than the ZX81 original speed. Switching is synchronized with the clock to avoid glitching the clock line. The original 4MHz Z80 CPU must be replaced with a 6 or 8MHz unit, preferably the CMOS version. The CPU clock is switched between 6.5MHz (HIGH) and 3.35MHz (LOW). The hard to find 6.5MHz "crystal" can be removed from the ZX81 and reused in the doubler circuit.

 

 

Great idea but any project that requires wiring 8 chips together without a PCB is a daunting task. What if the doubler circuit could be made simpler?

 

ZX-TURBO v1

 

The ZX-TURBO v1 circuit is similar in operation to Kevin's Clock Doubler but reduces the number of ICs from eight to just three. This reduction is paid for with additional diode logic but this design is much easier to understand than Kevin’s original circuit. 

 

 

PROGRAMMABLE CLOCK DOUBLER

 

The "programmable clock doubler" use dual FF IC2a and IC2b to divide the 6.5MHz oscillator output by 1 or by 2 depending on the state of the /turbo signal. This subsystem is purely edge triggered and bullet proof and does not rely on gate propagation delays or RC networks to ensure that the circuit changes between clock frequencies with zero jitter of the Z80 clock input.

 

When the /turbo signal goes low at the D input of IC2a, and the /CLR input of Ic2a is high, the next rising edge of /6.5M will transfer the low state on the D input to the Q output of IC2a and on to the /CLR input of IC2b. This low on /CLR causes Q of IC2B to reset. The low Q output of IC2b is connected to the /PRESET input of IC2a which immediately sets the Q output of IC2a. The resulting waveform on Q of IC2a is a narrow active low pulse, terminated as soon as the IC2b Q output is reset.

 

On the rising edge of 6.5M (ie the falling edge of /6.5M) IC2b always toggles state. If /turbo is high then the Q output of IC2b continues to toggle alternate high and low states on every rising edge of 6.5M and the circuit divides 6.5M by two (ie Z80 clk = 3.25MHz). If /turbo is low then, on every rising edge of 6.5M the Q output of IC2b is set (high) and on each falling edge of 6.5M, the Q output of IC2b is reset (low) and the circuit divides 6.5M by one (ie Z80 clk = 6.5MHz).

 

TURBO ON/OFF LATCH

 

The /turbo signal, which causes the Z80 clock to double in frequency, is the output of the "turbo on/off latch" made with two inverters. Any low on the D4-D7 diode AND gate at the reset input of the latch switches Z80 clocking to normal when:

 

a) the turbo enable latch is reset

b) the NMI generator is turned off (OUT FDh) at the beginning of a screen display. 

c) the tape LOAD or SAVE routine is called (OUT FFh)

d) the HALT state is active at the top of the screen Display

 

The turbo latch is set and clocks the Z80 at double speed when the NMI generator is started (OUT FEh) returning to application program execution.

 

TURBO ENABLE LATCH

 

The "turbo enable latch" which controls the "turbo on/off latch" is set and reset by the programmer with a write to I/O address 36h and 37h or can be manually enabled with pushbutton S1. The turbo LED is on when in the turbo mode. A second pushbutton S2 could be added to manually reset the turbo enable latch.

 

TURBO DECODER

 

The 74HC138 decoder (IC3) decodes I/O addresses Feh and FDh which start and stop the ZX81 NMI generator, I/O address FFh used in the TAPE routines system and the two control addresses (36f and 37f) to enable and disable to ZX-TURBO v1 circuit.

 

Having gone this far, could the ZX-TURBO v1 itself be simplified?

 

ZX-TURBO v2   -  A Bare Bones Clock Doubler

 

The ZX-TURBO v2 schematic shows an even simpler manually controlled version of this circuit.

 

 

 

The Programmable Z80 Clock Doubler works exactly as described in v1 above. 

 

When S1 is closed the Z80 executes in the normal clock mode. When S1 is opened the Z80 is clocked at double speed during SLOW mode user program execution. There is no automatic detect of RESET or TAPE functions, so the user must close S1 prior to executing RESET or SAVE and LOAD.

 

After reading the description of the v1 circuit, the v2 circuit operation is relatively easy.

 

The S1 switch takes the place of the turbo enable latch of v1. When S1 is closed the ZX81 is in the normal speed mode. When S1 is open and the LED is on, the ZX81 is in the turbo mode when executing the application program.

 

The /turbo signal, which causes the Z80 clock to double in frequency, is the output of IC1d of the "turbo on/off latch" made with two NAND gates. The latch switches Z80 clocking to normal when:

 

a) S1 is closed 

b) the NMI generator is turned off (OUT FDh) at the beginning of a screen display. 

c) the HALT state is active at the top of the screen Display

 

The turbo latch is set and clocks the Z80 at double speed when the NMI generator is started (OUT FEh) at the return to slow mode application program execution.

 

This is about as simple as a ZX81clock doubler gets but don't let that stop you from “taking ZX-TURBO to the min”!

 

enjoy

 

wilf