Z80-Cpu Instruction Set - ZiLOG Z80-CPU Technical Manual

Table of Contents

Advertisement

5.0 Z-80 CPU INSTRUCTION SET
The Z-80 CPU can execute 158 different instruction types including all 78 of the 8080A CPU.
The instructions can be broken down into the following major groups:
• Load and Exchange
• Block Transfer and Search
• Arithmetic and Logical
• Rotate and Shift
• Bit Manipulation (set, reset, test)
• Jump, Call and Return
• Input/Output
• Basic CPU Control
5.1
INTRODUCTION TO INSTRUCTION TYPES
The load instructions move data internally between CPU registers or between CPU registers and exter-
nal memory. All of these instructions must specify a source location from which the data is to be moved
and a destination location. The source location is not altered by a load instruction. Examples of
load group instructions include moves between any of the general purpose registers such as move the data
to Register B from Register C. This group also includes load immediate to any CPU register or to any
external memory location. Other types of load instructions allow transfer between CPU registers and
memory locations. The exchange instructions can trade the contents of two registers.
A unique set of block transfer instructions is provided in the Z-80.With a single instruction a
block of memory of any size can be moved to any other location in memory. This set of block moves
is extremely valuable when large strings of data must be processed. The Z-80 block search instructions
are also valuable for this type of processing. With a single instruction, a block of external memory
of any desired length can be searched for any 8-bit character. Once the character is found or the end of the
block is reached, the instruction automatically terminates. Both the block transfer and the block search
instructions can be interrupted during their execution so as to not occupy the CPU for long periods of time.
The arithmetic and logical instructions operate on data stored in the accumulator and other
general purpose CPU registers or external memory locations. The results of the operations are placed
in the accumulator and the appropriate flags are set according to the result of the operation. An
example of an arithmetic operation is adding the accumulator to the contents of an external memory
location. The results of the addition are placed in the accumulator. This group also includes 16-bit
addition and subtraction between 16-bit CPU registers.
The rotate and shift group allows any register or any memory location to be rotated right or left
with or without carry either arithmetic or logical. Also, a digit in the accumulator can be rotated right
or left with two digits in any memory location.
The bit manipulation instructions allow any bit in the accumulator, any general purpose register
or any external memory location to be set, reset or tested with a single instruction. For example,
the most significant bit of register H can be reset. This group is especially useful in control applications
and for controlling software flags in general purpose programming.
The jump, call and return instructions are used to transfer between various locations in the user's
program. This group uses several different techniques for obtaining the new program counter address
from specific external memory locations. A unique type of call is the restart instruction. This instruction
actually contains the new address as a part of the 8-bit OP code. This is possible since only 8 separate
addresses located in page zero of the external memory may be specified. Program jumps may also
be achieved by loading register HL, IX
or
IY directly into the PC, thus allowing the jump address to
be a complex furiCtion of the routine being executed.
19

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Z80-CPU and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Z80a-cpu

Table of Contents