Chapter 1. Assembly Language and Processors
Work Registers
The
8080
provides an 8-bit accumulator and six other general purpose work registers,
as
shown
in
Figure 1-3.
Programs reference these registers
by
the letters A (for the accumulator),
B,
C,
D,
E,
H,
and
L.
Thus, the
instruction ADD B may be interpreteu
as
'add the contents
of
the B register to the contents of the accumu-
lator.
Some instructions reference a pair
of
registers
as
shown
in
the following:
Symbolic Reference
B
D
H
M
PSW
Registers Referenced
Band
C
D and E
Hand
L
Hand
L
(as
a memory reference)
A and condition flags (explained
later
in
this section)
The symbolic
reference for a single register
is
often the same
as
for a register pair. The instruction to
be
executed
determines how the processor interprets the reference. For example,
ADD
B
is
an 8-bit operation.
By
contrast
PUSH
B (which pushes the contents of the
Band
C registers
onto
the stack)
is
a 16-bit operation.
Notice
that
the letters
Hand
M both refer to the
Hand
L register pair. The choice of which to use depends on
the instruction.
Use
H when
an
instruction ae:s upon the
Hand
L register pair
as
in
INX
H (increment the
contents
of
Hand
L
by
one).
Use
M when an instruction addresses memory
via
the
Hand
L register,
as
in
ADD
M (add the contents
of
the memory location ';pecified
by
the
Hand
L registers to the contents of the accumu-
lator) .
The general purpose registers
B,
C,
D,
E,
H,
and L can provide a wide variety
of
functions such
as
storing 8-bit
data values, storing intermediate
results
in
arithmetic operations, and storing 16-bit address pointers. Because
of
the
8080's
extensive instruction set, it
is
usually possible to achieve a common result with any
of
several
different instructions. A simple add to the accumulator, for example, can be accomplished
by
more than half a
dozen different instructions. When possible, it
is
generally desirable
to
select a register-to-register instruction
such as ADD
B.
These instructions typically require only one byte
of
program storage. Also, using data already
present
in
a register eliminates a memory access and thus reduces the time required for the operation.
The accumulator also acts
as
a general-purpose register,
but
it has some special capabilities not shared with the
other registers. For example, the
input/output
instructions
IN
and OUT transfer data only between the accumu-
lator and external
1/0 devices. Also, many operations involving the accumulator affect the condition flags as ex-
plained
in
the next section.
Example:
The
following figures illustrate the execution
of
a move instruction. The
MOV
M,C
moves a copy
of
the contents
of register
C to the memory location specified
by
the
Hand
L registers. Notice that this location must
be
in
RAM
since data
is
to
be
written to memory.
1-7