Download Student Papers in Computer Architecture, 2006

Transcript
R ICHARD N ORDENSKJÖLD AND H ÅKAN F ORS N ILSSON
53
12. ZiLOG Z80
12.1 Introduction
In 1976 the ZiLOG company released a new product. That was the Z80 microprocessor. The Z80 was based on the Intel 8080 processor, and was completely backwards
compatible with the 8080 [4, 5].
The Z80 had all the registers and the 78 instructions the 8080 had, as well as 80
more instructions and more registers [7, 3]. It has been made in three different models
that are simply called A, B and C. The only difference between the models are their
maximum clock speed [5].
The Z80 is an 8-bit CISC (complex instruction set computer) microprocessor [3].
This means that a single instruction can execute several other instructions in order to
simplify the machine code programming. The first version of the Z80 was clocked at
2.5 MHz [1].
12.2 Registers in the Z80
The Z80 has 20 8-bit and 4 16-bit registers as shown in Figure 12.1 on the following
page [3].
The 16-bit registers ([3] and [8, pages 2–5]):
• The PC (program counter) register contains the 16-bit address of the instruction
being fetched from the memory. Once the data has been fetched from the address,
the value of the PC is increased. When a jump instruction is being executed the
PC is overwritten with the new address instead of being increased.
• The SP (stack pointer) also contains a 16-bit address but it points to the top of
the external stack (located in the RAM). This stack enables the Z80 to handle
recursion and nested subroutines.
• The IX and IY (index) registers are useful for addressing arbitrary sections of
memory when using blocks of data.
The 8-bit registers ([3] and [8, pages 2–5]):
• The A and A’ registers are the accumulators which are used for all the calculations. F and F’ are the flag registers which store whether the result from the ALU
is negative, positive or zero.
• The I and R registers are used internally by the CPU. I is for interrupts and R is
for refreshing dynamic RAM.
• The rest of the 8-bit registers are multipurpose registers that are divided into two
groups of six. In each group there are 3 pairs of registers that may be used as
two 8-bit registers or one 16-bit register.
Student Papers in Computer Architecture, 2006