On Mon, Apr 22, 2024 at 01:06:42AM +0100, Peter Coghlan via cctalk wrote:
[...]
This was implemented by a humble 6502 running at
(mostly) 2MHz, with one 8
bit arithmetic register, two 8 bit index registers, one 8 bit stack
pointer, a 16 bit program counter and a few flag bits.
I would have expected that a computers featuring a Z80
with its larger
register set, 16 bit arithmetic operations, richer instruction set and
general bells and whistles would have been able to produce a much superior
implementation in terms of speed or features or both but I never came
across one.
Why is that? Did the Z80 take more cycles to implement
it's more complex
instructions? Is this an early example of RISC vs CISC?
Technically yes, but the implicit assumption in the question is wrong.
The Z80 takes three or four memory cycles to perform a memory access versus
the 6502 accessing memory on every cycle, but Z80 systems tend to be clocked
3-4 times faster so the memory bandwidth is pretty much the same. This
shouldn't be too surprising: they were designed to use the same RAM chips.
So the Z80 takes more cycles, but it was designed to use a faster clock and
do simpler operations per clock as that saved die space. Clock speeds have
*never* been a good way to compare CPUs.
In the hands of an expert in their respective instruction sets, both
architectures perform about as well as each other for a given memory
bandwidth (which was and still remains the limiting factor on CPUs without
caches). The 6502 could be said to "win" only in as much as the modern
drop-in replacement is the 14Mhz 65C02S, whereas the Z80's is the Z804C00xx
which tops out at 20MHz so is only equivalent to a ~5MHz 6502.
For the same reason, a 14MHz 65C02S will leave a 68000 (maximum 16.67Mhz) in
the dust, especially when working with byte-oriented data such as text where
the wider bus doesn't help. The 68000 takes four cycles to perform a memory
access, and inserts a couple of extra cycles of dead time for certain
addressing modes which require extra work in the address-generation
circuitry.
Even back in the day, it was noted that the Sinclair's ZX Spectrum with its
3.5MHz Z80 could outperform their later QL with its 7.5MHz 68008.