Sharp MZ-80A Owner's Manual page 174

Hide thumbs Also See for MZ-80A:
Table of Contents

Advertisement

184
3.0 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
3.1 INTRODUCTION TO INSTRUCTION TYPES
The load instructions move data
internally between CPU
registers
or
between CPU
registers
and external
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
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-8U.
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
Hags
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
1 6-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 Hags
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
function of
the routine being executed.

Advertisement

Table of Contents
loading

Table of Contents