Micro Computer Comparison – Part 2

In the first part of this series I compared the memory bandwidth of the Commodore 64 (know as the C64 for short) and the ZX Spectrum. If you haven’t read the first part you will find it here.

Today I will compare the two microprocessors used by the systems, that is the Moschip 6502 and the Zilog Z80 processors. In the last part I found that memory bandwidth wise, both processors have roughly the same ability at the speeds used and that the difference in memory performance was up to the physical architecture of the systems in which they are operating in. To understand how much work each processor is capable of doing I will be looking at the impact of the internal structure and instruction sets.

This will most likely be another very long post!

Firstly lets look at the registers available in both processors. The 6502 has three registers, A, X and Y, of which only the A register is general purpose. Reading through the instruction set it appears that most if not all of the arithmetic and logical operations need the A register, this means that for any meaningful calculations or processing you really need to use memory outside the processor to store your variables. This costs additional instructions to move values into and out of the accumulator, and extra memory access cycles to read operands for the logical and arithmetic instructions. If you want to check out the instruction set for yourself here is a website with lots of details including the cycle times per instruction.

Something else that is of note is that it only supports memory mapped IO for hardware attached to it. This doesn’t sound like it is all that bad, but it means any hardware needs to use memory address space in order to communicate with the processor. This is bad for a couple of reasons. Rouge programs can easily access hardware registers and interfaces accidentally in ways that can adversely affect the operation of the devices, and it reduces the amount of usable system memory available to programmers.

It isn’t all bad news however as the 6502 has some features to make your life a bit easier when writing assembly. Firstly it has the most versatile set of addressing modes that apply to pretty much all instructions that use memory directly. This makes using memory locations for variables in algorithms a lot easier than would otherwise be possible. The stack is unfortunately rather small, so using it is not really an option for temporary variables.

The instructions themselves take 2 cycles to complete at a minimum, so the rate of execution isn’t exactly stellar. Optimising code is quite a challenge as there are so few instructions, but being a simple instruction set it is much simpler and easier to program.

The Z80 processor is a different beast entirely! It has significantly more registers than the 6502. There are 8 different 8 bit registers arranged into 4 pairs and two 16 bit memory indexing registers. Because there are so many registers you can store many of your program variables in the registers and save cycles by not requiring as many memory accesses. Again like the 6502 a lot of the arithmetic instructions use the 8 bit A register, but the other registers can have some arithmetic performed on them in the form of incrementing and decrementing. Even 16 bit addition and subtraction is possible on the HL pair of registers.

The Z80 has a much larger instruction set, so it is much harder to talk about cycles used. The Z80 machine cycles are roughly the same length as the 6502 cycles, and it takes at a minimum of 1 machine cycle for instructions that use the registers only. So code that makes good use of the registers will tend to be faster than code on the 6502. It won’t be twice as fast however as there will be slower code intermixed with with the faster register only code. The 6502 whilst slower is still pretty impressive, as it isn’t that far behind the Z80 in speed of execution with a quarter of the clock speed!

The real advantage of the Z80 over the 6502 is that more work can be done per instruction. There are instructions for copying blocks of memory, and for searching blocks of memory. They are so much faster that if you were to write code on either processor that did it another way your code would be significantly slower. 16 bit basic arithmetic is also faster as it can be done with single instructions as opposed to the several required on the 6502.

So what kind of impact does this have on the capabilities of the microcomputers? Well it depends on the kind of application you are talking about and hardware features that they use. The Spectrum by virtue of having a Z80 is more capable of 3d graphics that require more CPU, and can do graphics which require a lot of screen blitting well such as scrolling. The C64 is not suited to 3d graphics as it lacks the processing power to do it, but the lack of processing power is made up by the extensive capabilities of the VIC II chip. As I said last time, sprites on the C64 make games a breeze as long as you don’t run out of hardware sprites. By taking less time rendering the sprites, the 6502 in the C64 now has more time to do things it isn’t good at such as copying large amounts of memory for scrolling backgrounds.

I won’t go into detail about the fanboy claims about the 6502 being faster than the 8088 as they are patently ridiculous. The 8088 is sort of a descendant of the Z80 which we know is faster. The z80 was originally based on an Intel chip, the 8080, which is the predecessor to the later Intel 8085, 8086 and 8088. The Z80 wasn’t a direct copy however, it added many features that made it superior to the original 8080 chip. The 8086 and 8088 were basically the next generation of processors at the time, and were much more complex. They had all the features of the Z80 and did them faster, whilst also having many more features not supported on the older chips.

In the end the Z80 is faster than the 6502, but not by the large amounts that fanboys like to argue. I also think the 6502 is a fantastically engineered chip, it’s amazing how much it manages to do at 1Mhz whilst being so simple in design. It was one of the first true low cost microprocessors of its time and is what really made the PC revolution start with the early Apple computers. The Z80 however was faster and became much more widespread. It was a big part of the early machines, and became dominant in the C/PM market of computers. They also ended up in embedded designs everywhere, in arcade machines and numerous other types of devices. In fact it has been so widely used, that it is still available today!

0 Responses to “Micro Computer Comparison – Part 2”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your email address to follow this blog and receive notifications of new posts by email.

Mister G Kids

A daily comic about real stuff little kids say in school. By Matt Gajdoš

Random Battles: my life long level grind

completing every RPG, ever.

Gough's Tech Zone

Reversing the mindless enslavement of humans by technology.

Retrocosm's Vintage Computing, Tech & Scale RC Blog

Random mutterings on retro computing, old technology, some new, plus radio controlled scale modelling.


retro computing and gaming plus a little more

Retrocomputing with 90's SPARC

21st-Century computing, the hard way

%d bloggers like this: