I just posted a thread on lemon forum (c64 enthusiasts) about 6502 VS z80

Started by xubuntu, 15:13, 05 November 22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


I just posted a thread on lemon forum (c64 enthusiasts) about 6502 VS z80, about how the 6502 could be superior to z80, because I really can't see how.

But I'd like also YOUR opinion.

z80 has more instructions, it is faster.

Am I comparing the wrong competitors? But I ain't.

How about reliability ?

ps. Are z80s still being made?


Many say that 6502 is faster.
Dunno about numbers, real life tests are the best.
Z80 machines have better 3D and racing games.
That is enough for me  ;D


It is hard to compare the two CPUs directly because they have different approaches to how they do things.
The 6502 has very few instructions, but most of them are executed very fast.
The Z80 has many instructions, but some of them take a lot of time to execute.

The 6502 only have 3 usable registers, but can use the first 256 bytes of memory (zeropage) almost as fast as internal registers.
The Z80 have a lot more registers to work with.

To show what I am talking about:
Loading an immediate value to a register takes 2 clock cycles on the 6502, the same function on a Z80 uses 7 clock cycles.

On the other hand, the Z80 have instructions like LDIR which is able to copy an entire block of data from one part of memory to another.
There is no such instruction in the 6502, there you would have to keep source and destination pointers in zeropage memory and ensure to update them your self after every copied byte.


Also just using "clock cycles" for direct comparison is apples and oranges. The 6502 generates a second phase shifted clock so that technically there are twice as many clock states for itself and other devices on the bus compared to the input clock. So instructions use half as many input clock cycles as the z80, but it limits the maximum input clock speed significantly. The Z80 just uses the input clock directly, so it needs 2x more input clock cycles, but the clock speed can go much higher than just 2x that of the 6502.


Z80 pros:

- the 6502 is a bad choice for high-level programming languages.
With its limited stack size of 256 entries it can't handle nested function calls in high level languages, as these use the stack for passing parameters as well, no matter if they are interpreted or compiled. Because of this you have to implement a "software" stack, which is much slower.

- with its fixed 256 byte stack and fixed 256 byte zero page it is much harder to do fast context switching in a multitasking environment.
Either you split the stack and the zero page in smaller parts and allocate these for each task. Or you have to copy the whole stack and zero page during each context switch, which would be terrible slow probably. The Z80 can move the stack pointer everywhere in the visible 64K area and just have to push and pop all its registers during a context switch. However FlashJazzCat demonstrated with its A8GOS, that it is still possible to do a fast context switch on the 6502 (I think he used the split trick or a combination of both).



Quote from: xubuntu on 15:13, 05 November 22I just posted a thread on lemon forum (c64 enthusiasts) about 6502 VS z80, about how the 6502 could be superior to z80, because I really can't see how.
Totally agreed the Z80 (Porsche) vs. the 6502 / 6510 (Volkswagen) is just not a really fair competition.

Would be of greater interest to compare C64 and Atari 800XL (CPU wise)

Just my 3 Pfennige (Pennies, Cents or what you prefer).  :)
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Powered by SMFPacks Menu Editor Mod