The Zilog 80 processor chip was a strong contender in late 70's and early 80's computers such as the Sinclair brands. Running at between 1 and 2 Mhz it was an 8 bit chip with, if I remember correctly, one accumulator and one register. In 1989 it was chosen for use in the Nintendo Gameboy and a souped-up version remained in the 1998 Color Gameboy. It's main competitor in the 80's was the 6502.

The Z80 was Zilog's attempt to compete with the Intel 8080. It's main competitor was the Intel 8080 and Intel 8085. I believe the Z80 had 16 registers, but only 8 could be addressed at any one time. It came in many speeds, with the 1 and 2 MHz versions being popular in home computers, and the 4 MHz version being popular in bigger CP/M based systems.

Contrary to some reports, the Z80 did not have "one accumulator and one index register". It had an 8-bit accumulator A, 16-bit registers (and register pairs) BC, DE, HL, IX, IY, and alternate registers A', BC', DE', HL'. It also had a flags register F (alternate F'), a stack pointer SP, and program counter PC.

Breaking up the register pairs gives 16 general purpose registers (or 18 if you count IXH, IXL, IYH, and IYL which were undocumented but worked fine).

Not bad for an 8-bit
machine.

The Z80 was the chip within the Timex Sinclair ZX-81, incidentally, but was primarily used within CP/M systems.

The Z80 is actually still used and produced (belive it or not). And come in forms that can very greatly, but rest assured they are forms that are faster then 4 MHz. The Z80 was used in many home computers and consoles as evilandi mentioned (Including: Gameboy, Sega Master System, NeoGeo, etc) - it was also used in just about every pice of arcade hardware from the 80's till now (Including the renound CPS & CPS2 systems, Segas System 8, System 16, and System 24, SNK's MVS NeoGeo system, etc, etc, etc....).

The Z80 is used quite alot with sound processing, for example QSound based boards almost always (I say almost as I'm sure theres an exception, but I can think of it) use a Z80.

The Z80A is still in use these days. The US Navy's SH-60B helicopter, made by Sikorsky, uses one in its flight computer. The military depends on older tested and trusted electronics.

The Z80 is also used in the TI-8X (except for the 89) series of graphing calculators. Many Z80 assembly language programs (read: games) are available for almost every TI-8X calc, with the TI-85 probably being the most popular. The assembly language "shell" used to enable these programs is called ZShell because of the Z80.

For those of you who care, here is some technical information on the Z80 and the Z80 assembly language.

There are 16 general purpose registers, each 8 bits wide. The registers are named a, b, c, d, e, f, h and l. Registers can also be "doubled up" to form 16-bit register pairs. The pairings are af, bc, de, hl (ONLY these pairings are valid pairings).

The f register is called the flags register. Its 8 bits form eight 1-bit flags that can be tested with certain instructions. The flags are:

BIT - FLAG
0 - Carry (C)
1 - Subtract (S)
2 - Parity/Overflow (P/O)
3 - Unused/Unknown
4 - Auxilliary Carry (AC)
5 - Unused/Unknown
6 - Zero (Z)
7 - Sign (S)

Some of the flags are obvious, some are not. For instance, Zero is usually asserted when the result of the last instruction is zero. Sign is asserted when the result of the previous instruction is negative. Other flags have more mysterious uses.

The a register is called the accumulator, and the results of 8-bit adds and subtracts are sent to it. The results of most 16-bit operations are sent to the register pair hl. The Z80 has no multiply or divide instructions.

The Z80 also has 16 8-bit shadow registers called a', b', c', d', e', f' h', l'. The shadow registers also form shadow register pairs af', bc', de', hl'. The shadow registers cannot be accessed directly; Instead, we may use the instructions "EX AF,AF'" to swap af with af', or "EXX" to swap bc, de, hl with bc', de' and hl'. The shadow registers are found on some but not all Z80 processors. For instance, the Z80 in the Nintendo Gameboy does not have shadow registers.

There are some other special purpose 16-bit registers in the Z80. sp is called the "stack pointer" and is used to keep the memory address of the topmost item in the stack. pc is the "program counter" and points to the location of the next instruction to be executed. ix and iy are "index registers". There are also two more special 8-bit registers: i, the "interupt vector register" and r, the "refresh register".

The stack is generally maintained through the instructions PUSH and POP. "PUSH rp" can be used to put any register pair "rp" onto the top of the stack, and "POP rp" will take 16-bits from the top of the stack and put it into the register pair "rp".

Z80 assembler has some useful but complex pseudoinstructions. My personal favorite is CPIR which stands for "Compare Accumulator With Memory. Decremenet Byte Counter. Increment Address. Continue Until Match Is Found Or Byte Counter Is Zero."

If you have a burning desire to learn Z80 assembler, I would highly recommend Lance A. Leventhal's Z80 Assembly Language Programming, published by McGraw-Hill. It is probably the only book you will ever need on the subject.

If I remember correctly, the z80 was designed to implement some behaviors of the 8080 so that code could be ported over to it relatively easy. I recall that one of the amusing things about the z80 was if you did this :

LD BC, 1
DEC BC

BC would have zero in it, but the cpu would not set the zero flag. So if you wanted to use BC in a loop, you could not just DEC BC and then make a conditional jump. You would have to something like:

myloop:
LD BC, count
(do some stuff)
DEC BC
LD A, B
OR C
JR NZ, myloop

The z80 is a lot of fun :-)

Log in or register to write something here or to contact authors.