EasyManua.ls Logo

Intel 8080 - B2_Page_03

Intel 8080
224 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter
3.
Instruct"lon Set
Opcode
Operand
CALL address
The address
may
be
specified
as
a number, a label, or an expression. (The label
is
most common.) The as'>embler
inverts the high and low address bytes when
it
assembles the instruction.
1
1
0
Cycles:
S
ta tes:
Addressing:
Flags:
Example:
0
1
q
0 1
lowaddr
high
addr
5
17 (18 on 8085)
immediate/register indilTct
none
When a given coding sequence
is
required several times in'a program, you can usually conserve memory by coding
the sequence as
a subroutine invoked by the CALL instruction or one
of
it<,
varianI',. For example, assume that
an
application drives a six-digit
L.ED
display; the display
is
updated as a result
of
dn
operator
input or because
of
two different calculations that occur
in
the program. The coding required to drive the display can be included
in-line at each
of
the three
point,
where
it
is
needed, or
it
can
be
coded
as
a subroutine.
If
the label
DISPL.
Y
is
assigned to the first instruction
of
the display driver, the following
CAL.L.
instruction
is
used to invoke the
display subroutine:
CAL.L.
DISPL Y
This
CALL.
instruction pushes the addle)s
of
the next proglam instruction
onto
the stack and then transfers
control to the
DISPL.
Y subroutine. The
DISPL.
Y ,uilroutine must execute a return instruction or one
of
its
variants to resume normal program flow. The following
is
a graphic illustration
of
the effect
of
CAL.L
and return
instructions:
CAL.L.
--
---
_;
DISPL.
Y:
CAL.L.
~
-f2..I~~Y_-_-_~~~
___
~
------~RET
CA
L. L.
DISPL.
Y
Consideration
for
Using Subroutlt7es
The larger the code segment to
be
repeated and the greater the number
of
repetitions, the greater the potential
memory savings
of
using a subroutine. Thu" if the display driver
in
the previou, example requires one hundrecl
3-9

Table of Contents

Related product manuals