Z80 speed?

Started by Christian Johansson, February 08, 2007, 04:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Christian Johansson

I feel a bit unclear when it comes to the speed the Z80 runs with. As I understand it, the Z80 runs with 4 MHz for half of a clock cycle making an effective speed of 2 MHz. During the other half, the former Commodore engineer Fred Bowen has written in an old quote in another post in this forum that the Z80 is not stopped but it can't access the databus. However, I guess there is not much you can do without being able to access the databus.

I also make the following assumptions but they might be wrong so please correct me:

1. 2 MHz mode (fast mode) only affects the 8502 processor and not the Z80. At least, this is what it looks like when I look in circuit diagrams and I have never read that you can be able to run the Z80 both clock cycles. I guess I would have read it if would be possible but I might be wrong.

2. Blanking the VIC screen makes the Z80 slightly faster just as is the case for the 8502 since the VIC doesn't have to steal some of the CPU clock halves.

hydrophilic

1.  I believe the same as you: the Z80 is always running at '2MHz' and never slows down for memory refresh or I/O access since it always access data during PHI 1 (AEC hi).  This is based, like you, from the schematics, but also from the timing diagrams in the C128 Programmers Reference Manual.  It also how I implemented 2MHz for the Z80 in my VICE patch.

2.  I believe you are also correct here.  When the screen is active (or sprites are enambled), the VIC _must_ monopolise the address/data busses for certain activities (character pointer and sprite data fetches).  So blanking prevents the character fetches and makes the Z80 a little faster, just like some programs on the C64 do (crunchers, etc.)

I did an experiment when my C128 still lived, and the execution time (in approximate microseconds) of each opcode is exactly the T states / 2.  The 'T states' (opcode cycle count) are documented in most books on Z80 programming; 'approximate microseconds' is about 0.98us for NTSC and 1.02us for PAL.

Fred Bowen might mean that it is not stopped in the normal method, using BUSRQ, but is instead 'stopped' by simply not sending clock pulses during PHI 1 (AEC hi).  I can think of lot of questions to ask him :)

Reason for Edit I reversed the NTSC and PAL times.