|QL User appears each month within the pages of Your Spectrum. Look out too for the 'Complete Dossier' edition - in the shops this July.|
The difference between the Z80 and 68008 processors is one of philosophy, contends Simon Goodwin, and not just a matter of a few extra bits.
FIRST THINGS FIRSTThe first microprocessors were designed in a rather ad hoc manner, rather like the first computer programs. A few people thought for a while and came up with the bare bones of design - the internal timing of instructions, the interface between processor and memory, and some idea of the 'logical operations' possible - rotating values, adding, setting bits and so on. Parts of the design were built up and tested in hand- made units, each comprising of a few hundred 'building-block' chips.
Once the bare bones were established, the race was on to flesh them out as much as possible. In essence, the designers considered each part and tried to work out all of the useful things that could be done with it. In the process they added a few registers, took away an operation, and so on until the chip - the slice of silicon used as a base for the processor - was chock- a -block with transistors. Then they tested everything and produced a book listing the 'instruction set' of the device; if anything didn't work, they just didn't mention it at all!
This approach to processor design was appropriate to the first micros: they were squashed onto quite a small area of silicon, with no room for an elaborate design. The resultant chips were hard work but great fun to program. Just because
an instruction worked in one circumstance didn't mean it would even exist in the next! |
The Intel 8080 was the first really useful microprocessor; then a group of people left Intel, cut a bigger piece of silicon, and came up with the Zilog Z80. Not surprisingly, this device turned out very similar to the 8080 - in fact, it would run 8080 programs. Zilog used its extra silicon to stitch on lots of extra instructions.
The 8080 had eight-bit increment instructions. The company added 16-bit equivalents, but there wasn't room to make them work; ie. exactly the same way, so that the new instructions didn't 'flag' the result of the operation (zero, overflow or whatever).
Zilog added about 450 'official' instructions to the repertoire of the Z80, but in the process it created another hundred or so 'unofficial' ones which were never mentioned! A determined hacker can uncover all sorts of oddities, like an 'eight-bit double and increment' - the missing SLL (shift left logical) instructions: CBH 30H to CBH 37H. These form a conspicuous gap on page 184 of the Spectrum manual! |
The first processors were designed with hardware problems in mind - there was no point coming up with a super-whizzo useful set of instructions if they couldn't be built into a chip! In the last ten years these hardware problems have eased, while software problems have multiplied.
PROGRAMMING PHILOSOPHYThe Z80 was designed specifically for ease of wiring up. The 68000, on the other hand, was approached from the point of view of programming simplicity; part of this ease stems from the fact that you don't have to throw away your programs when you move from one modern processor to a cheaper or faster one.
Motorola designed a range of processors, rather than a one-off. The original 68000 has spawned a number of versions with differing hardware requirements (including the so-called 'eight-bit' 68008 and the '32-bit' 68032) - but they can all run exactly the same software. This is what Sinclair Research is trying to say when they call the QL 'future-proof'.
On a Z80, every register has its idiosyncracies; only the C register can be used to address ports, only the B register can be used in fast loops, only IX and IY can have an index, and so on. With the 68000 series, however, sets of registers work identically; each can be, for example, an index register, a stack pointer or a counter - the same instructions are available regardless of the register chosen. The data registers of the 68000 family are all 32 bits long, regardless of the way that data is passed back and forth between processor and memory (this varies between members of the 'family').
This consistency makes it easy to learn the 68000 instruction set;
you don't have to cope with all the quirks of the Z80. The symmetry also makes it easy to fix bugs, alter programs and write compilers - it's much more difficult to write a good Z80 compiler because of the vast range of special cases which must be allowed for before there's any chance of producing the best code. |
A good compiler for the 68000 can produce code - from a high level language such as 'C' - which is very nearly as efficient as hand- written code. That's how QDOS and the most popular 68000 operating system, UNIX, can be written almost entirely with a compiler rather than an assembler. Compiled programs are much easier to write and test than assembled ones.
COMPLEX INSTRUCTIONSIn theory, a 16-bit micro is twice as powerful as an eight-bit machine - it can process twice as much information in a single step. In practice, though, the difference is usually much greater, because intermediate steps are usually needed to convert two eight-bit answers into a 16-bit result. The 68008 produces the 16-bit result immediately.
The 68008 incorporates complex instructions which do in one step what for a simpler processor would take many. For instance, the 68008 can perform 32-bit multiplication and division in a single and fast step. The equivalent
process would take well over a hundred steps on a Z80. The 68008 doesn't sacrifice flexibility by using its 32-bit registers - each instruction can be used in a 32-, 16- or the more concise eight-bit form. |
PIPELINE PERFORMANCEAnother big difference between the 68000 family and the Z80 lies in the way the 68000 reads values from memory. The 68000, like the humble 6502, uses a technique called 'pipelining'. A processor works by fetching instructions, decoding them and then performing the appropriate actions. Whereas the Z80 performs these three actions one- by- one, the 68000 uses a completely separate unit to read instructions, so that it can get on with reading the next few instructions while the rest of the processor is working out what the last one meant.
The 68008 has often been criticised because it reads and writes data in small eight-bit sections; a 'true' 16-bit processor would use larger lumps. But the difference in performance between 68000 and 68008 is much less marked than you might expect because the pipeline allows the processor to get on with fetching the data piecemeal while the instruction is being decoded. So, by the time the data is needed, it's usually in the pipeline and the 68008 doesn't have to wait for it to be fetched, eight bits at a time.
|Original text © 1984 Simon N Goodwin. Used with permission.|