Z80 Overview

26
Z80 Overview internal architecture and major elements of the Z80 CPU

description

Z80 Overview. internal architecture and major elements of the Z80 CPU. Z80 Registers. All Z80 registers are implemented using static RAM. The registers include two sets of six general-purpose registers that may be used individually as 8-bit registers or in pairs as 16-bit registers. - PowerPoint PPT Presentation

Transcript of Z80 Overview

Page 1: Z80 Overview

Z80 Overview

internal architecture and major elements of the Z80 CPU

Page 2: Z80 Overview

Z80 RegistersAll Z80 registers are implemented using static RAM.

The registers include two sets of six general-purpose registers that may be used individually as 8-bit registers or in pairs as 16-bit registers

There are also two sets of accumulator and flag registers and sixspecial-purpose registers.

Page 3: Z80 Overview

General Purpose Registers - -8Two matched sets of general purpose registers, each set containing six bit

iiiiiiiiiiii ii i -iii iiiiiiiii ii ii i i -iii iiiiiiii, 8 1 6 ii iiiiii iii i ii iii i i i iiii iii iii iiii iiiiii iii ii. , , i iii ii iii iii iii ii iii iiiiiii i ii iii iiiiii iiiiii, , . ,

iii ii iiiiiiiii ii i iii iiiiiii i iiiiii iiiiiiii iii i iii iii iii iiiiii set. In systems that require fast interrupt response, one set of generalpurpose

iiiiiiiii iii ii ACCUMULATOR/FLAG register may be reserved for handling this fast routine. One exchange command is executed to switch routines. This greatly reduces interrupt service time by eliminating the

requirement for saving and retrieving register contents in the external stack - during interrupt or subroutine processing. These general purpose registers

are used for a wide range of applications. They also simplify programing, - specifically in ROM based systems where little external read/write memory

is available.

Page 4: Z80 Overview

Accumulator and Flag RegistersThe CPU includes two independent 8-bit accumulators and associated 8-bitflag registers. The accumulator holds the results of 8-bit arithmetic or logicaloperations while the FLAG register indicates specific conditions for 8-bit or1 16-bit operations, such as indicating whether or not the result of anoperation is equal to zero. The programmer selects the accumulator and flagpair with a single exchange instruction so that it is possible to work witheither pair.

Page 5: Z80 Overview

Special-Purpose Registers

Program Counter (PC)The program counter holds the 16-bit address of the current instructionbeing fetched from memory. The PC is automatically incremented after itscontents have been transferred to the address lines. When a program jumpoccurs, the new value is automatically placed in the PC, overriding theincrementer.

Page 6: Z80 Overview

Special-Purpose Registers

Stack Pointer (SP)The stack pointer holds the 16-bit address of the current top of a stacklocated anywhere in external system RAM memory. The external stackmemory is organized as a last-in first-out (LIFO) file. Data can be pushedonto the stack from specific CPU registers or popped off of the stack tospecific CPU registers through the execution of PUSH and POPinstructions. The data popped from the stack is always the last data pushedonto it. The stack allows simple implementation of multiple level interrupts,unlimited subroutine nesting and simplification of many types of datamanipulation.

Page 7: Z80 Overview

Special-Purpose Registers

Two Index Registers (IX and IY)The two independent index registers hold a 16-bit base address that is usedin indexed addressing modes. In this mode, an index register is used as abase to point to a region in memory from which data is to be stored orretrieved. An additional byte is included in indexed instructions to specify adisplacement from this base. This displacement is specified as a two'scomplement signed integer. This mode of addressing greatly simplifiesmany types of programs, especially where tables of data are used.

Page 8: Z80 Overview

Special-Purpose Registers

Two Index Registers (IX and IY)The two independent index registers hold a 16-bit base address that is usedin indexed addressing modes. In this mode, an index register is used as abase to point to a region in memory from which data is to be stored orretrieved. An additional byte is included in indexed instructions to specify adisplacement from this base. This displacement is specified as a two'scomplement signed integer. This mode of addressing greatly simplifiesmany types of programs, especially where tables of data are used.

Page 9: Z80 Overview

Interrupt Page Address Register (I)The Z80 CPU can be operated in a mode where an indirect call to anymemory location can be achieved in response to an interrupt. The I registeris used for this purpose and stores the high order eight bits of the indirectaddress while the interrupting device provides the lower eight bits of theaddress. This feature allows interrupt routines to be dynamically locatedanywhere in memory with minimal access time to the routine.

Page 10: Z80 Overview

Memory Refresh Register (R)The Z80 CPU contains a memory refresh counter, enabling dynamicmemories to be used with the same ease as static memories. Seven bits ofthis 8-bit register are automatically incremented after each instruction fetch.The eighth bit remains as programmed, resulting from an LD R, Ainstruction. The data in the refresh counter is sent out on the lower portion ofthe address bus along with a refresh control signal while the CPU isdecoding and executing the fetched instruction. This mode of refresh istransparent to the programmer and does not slow the CPU operation. Theprogrammer can load the R register for testing purposes, but this register isnormally not used by the programmer. During refresh, the contents of the Iregister are placed on the upper eight bits of the address bus.

Page 11: Z80 Overview

Arithmetic Logic Unit (ALU)The 8-bit arithmetic and logical instructions of the CPU are executed in theALU. Internally, the ALU communicates with the registers and the externaldata bus by using the internal data bus. Functions performed by the ALUinclude:

• Add / Subtract• Logical AND, OR, XOR• Compare• Left or Right Shifts or Rotates (Arithmetic and Logical)• Increment / Decrement• Set / Reset Bit• Test bit

Page 12: Z80 Overview

PIN DESCRIPTION

Page 13: Z80 Overview

PIN DESCRIPTION

Marker

1 20

2140

Page 14: Z80 Overview

Pin Functions

15 0A –A Address Bus (output, active High, tristate). A15-A0 form a 16-bit address

bus. The Address Bus provides the address for memory data bus exchanges(up to 64 Kbytes) and for I/O device exchanges.

7 0D –D Data Bus (input/output, active High, tristate). D7–D0 constitute an

8-bit bidirectional data bus, used for data exchanges with memory and I/O.

BUS

Page 15: Z80 Overview

Pin FunctionsSystem Control

IORQ Input/Output Request (output, active Low, tristate). IORQ indicates that

the lower half of the address bus holds a valid I/O address for an I/O read orwrite operation. IORQ is also generated concurrently with M1 during aninterrupt acknowledge cycle to indicate that an interrupt response vector canbe placed on the data bus.1M

Machine Cycle One (output, active Low). M1, together with MREQ,indicates that the current machine cycle is the opcode fetch cycle of aninstruction execution. M1 together with IORQ, indicates an interruptacknowledge cycle.

Page 16: Z80 Overview

Pin FunctionsSystem Control

MREQ Memory Request (output, active Low, tristate). MREQ indicates that the address bus holds a valid address for a memory read of memory write

operation.

RD Read (output, active Low, tristate). RD indicates that the CPU wants to

read data from memory or an I/O device. The addressed I/O device ormemory should use this signal to gate data onto the CPU data bus.

WR Write (output, active Low, tristate). WR indicates that the CPU data bus

holds valid data to be stored at the addressed memory or I/O location.

Page 17: Z80 Overview

Pin FunctionsSystem Control

RFSHRefresh (output, active Low). RFSH, together with MREQ indicates thatthe lower seven bits of the system’s address bus can be used as a refreshaddress to the system’s dynamic memories.

Page 18: Z80 Overview

Pin Functions

CPU Control

H H HH HALT State (output, active Low). HALT indicates that the CPU has

executed a HALT instruction and is waiting for either a non-maskable or amaskable interrupt (with the mask enabled) before operation can resume.During HALT, the CPU executes NOPs to maintain memory refresh.

INTInterrupt Request (input, active Low). Interrupt Request is generated byI/O devices. The CPU honors a request at the end of the current instruction ifthe internal software-controlled interrupt enable flip-flop (IFF) is enabled.INT is normally wired-OR and requires an externalpull-up for these applications.

Page 19: Z80 Overview

Pin Functions

CPU Control

NMI- - Non Maskable Interrupt (input, negative edge triggered). i i i iii i

higher priority than INT. NMI is always recognized at the end of the current ii iii iiiiii ii iii iiiiiiiii iiiiii iiii-iiiii iii, ,

automatically forces the CPU to restart at location 0066H.

RESETReset (input, active Low). RESET initializes the CPU as follows: it resetsthe interrupt enable flip-flop, clears the PC and registers I and R, and sets theinterrupt status to Mode 0. During reset time, the address and data bus go toa high-impedance state, and all control output signals go to the inactivestate. Notice that RESET must be active for a minimum of three full clockcycles before the reset operation is complete.

Page 20: Z80 Overview

Pin Functions

CPU Control

WAITWAIT (input, active Low). WAIT communicates to the CPU that theaddressed memory or I/O devices are not ready for a data transfer. The CPUcontinues to enter a WAIT state as long as this signal is active. ExtendedWAIT periods can prevent the CPU from properly refreshing dynamicmemory.

Page 21: Z80 Overview

Pin FunctionsCPU Bus Control

BUSACKBus Acknowledge (output, active Low). Bus Acknowledge indicates to therequesting device that the CPU address bus, data bus, and control signalsMREQ, IORQ RD, and WR have entered their high-impedance states. Theexternal circuitry can now control these lines.BUSREQBus Request (input, active Low). Bus Request has a higher priority thanNMI and is always recognized at the end of the current machine cycle.BUSREQ forces the CPU address bus, data bus, and control signals MREQIORQ, RD, and WR to go to a high-impedance state so that other devicescan control these lines. BUSREQ is normally wired-OR and requires anexternal pull-up for these applications. Extended BUSREQ periods due toextensive DMA operations can prevent the CPU from properly refreshingdynamic RAMS.

Page 22: Z80 Overview

Pin Functions

H HH Clock (input). Single-phase MOS-level clock.

+5V

GND

Page 23: Z80 Overview
Page 24: Z80 Overview
Page 25: Z80 Overview
Page 26: Z80 Overview