EasyManuals Logo

ZiLOG Z8 Technical Manual

ZiLOG Z8
166 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #54 background imageLoading...
Page #54 background image
DJNZ
Decrement and Jump
if
Nonzero
DJNZ
r,dst
Instruction
format:
Cycles
OPC
(Hex)
Address
Mode
dst
~
___
r
__
~
___
o_p_C
__
~1
I~
_____
d_s_t
______
~
12
if
jump
taken
10
if
jump
not
taken
rA
RA
Operation:
flags:
Exaq>le:
Note:
5-20
r=O
to
r
r
<--
r - 1
If
r
~
0,
PC
<--
PC
+
dst
The
working
register
being used as a
counter
is
decremented.
If
the
contents
of
the
register
are
not
zero
after
decrementing,
the
relative
address
is
added
to
the
Program Counter
(PC)
and
control
passes
to
the
statement
whose
address
is
now
in
the
PC.
The
range
of
the
relative
address
is
+127,
-128,
and
the
original
value
of
the
PC
is
the
address
of
the
instruction
byte
following
the
DJNZ
statement.
When
the
working
register
counter
reaches
zero,
control
falls
through
to
the
statement
following
DJNZ.
No
flags
affected
DJNZ
is
typically
used
to
control
a "loop"
of
instructions.
In
this
example,
12
bytes
are
moved
from
one
buffer
area
in
the
register
file
to
another.
The
steps
involved
are:
o
Load
12
into
the
counter
(working
register
6)
o Set
up
the
loop
to
perform
the
moves
o
End
the
loop with
DJNZ
LD
R6,
1112
LOOP:
LD
R9,OLDBUr
(R6)
LD
NEWBUr
(R6),R9
DJNZ
R6,LOOP
!Load Counter!
!Move
one byte
to!
!New
location!
!Decrement
and
!
!Loop
until
counter
O!
The
working
register
being used
as
a
counter
must
be
one
of
the
registers
04-7F.
Use
of
one
of
the
I/O
ports,
control
or
peripheral
registers
will
have undefined
results.

Table of Contents

Other manuals for ZiLOG Z8

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the ZiLOG Z8 and is the answer not in the manual?

ZiLOG Z8 Specifications

General IconGeneral
BrandZiLOG
ModelZ8
CategoryDesktop
LanguageEnglish

Related product manuals