CPCWiki forum

General Category => Off topic => Topic started by: xubuntu on 15:13, 05 November 22

Title: I just posted a thread on lemon forum (c64 enthusiasts) about 6502 VS z80
Post by: xubuntu on 15:13, 05 November 22
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?
Title: Re: I just posted a thread on lemon forum (c64 enthusiasts) about 6502 VS z80
Post by: VincentGR on 17:29, 05 November 22
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

Title: Re: I just posted a thread on lemon forum (c64 enthusiasts) about 6502 VS z80
Post by: jimmyd on 21:55, 05 November 22
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.
Title: Re: I just posted a thread on lemon forum (c64 enthusiasts) about 6502 VS z80
Post by: pelrun on 09:37, 06 November 22
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.
Title: Re: I just posted a thread on lemon forum (c64 enthusiasts) about 6502 VS z80
Post by: Prodatron on 10:55, 06 November 22
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).
Title: Re: I just posted a thread on lemon forum (c64 enthusiasts) about 6502 VS z80
Post by: GUNHED on 18:49, 06 November 22
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).  :)
Powered by SMFPacks Menu Editor Mod