User's Manual

BASIC INSTRUCTION SET
3.6.2.1 CONDITIONAL JUMP INSTRUCTIONS
Table 3ยท3 shows the conditional transfer mnemonics and their interpretations. The conditional jumps
that are listed
as
pairs are actually the same instruction. The assembler provides the alternate mnemon-
ics for greater clarity within a program listing.
3.6.2.2
LOOP INSTRUCTIONS
The
loop
instructions are conditional jumps that use a value placed in ex to specify the number of
repetitions of a software loop. All
loop
instructions automatically decrement ex and terminate the
loop when
ex
=0.
Four of the five loop instructions specify a condition of
ZF
that terminates the
loop
before ex decrements to zero.
LOOP (Loop While ex Not Zero)
is
a conditional transfer that auto-decrements the ex register before
testing
ex for the branch condition.
If
ex
is
non-zero, the program branches to the target label speci-
fied in the instruction. The
LOOP instruction causes the repetition of a code section until the operation
of the
LOOP instruction decrements ex to a value of zero.
If
LOOP finds ex
=0,
control transfers
to the instruction immediately following the
LOOP instruction.
If
the value of ex
is
initially zero, then
the
LOOP executes 65,536 times.
Example:
LOOP START_LOOP. Each time the program encounters this instruction, it decrements
ex and then tests it.
If
the value of ex
is
non-zero,
then:
the program branches to the
instruction labeled
START_LOOP.
If
the value in ex
is
zero, then the program continues
with the instruction that
follows
the LOOP instruction.
Table 3-3. Interpretation of Conditional Transfers
Unsigned Conditional Transfers
Mnemonic Condition Tested
"Jump If
...
"
JA/JNBE
(CF
or
ZF) = 0
above/not below nor equal
JAE/JNB
CF
= 0
above
or
equal/not below
JB/JNAE
CF
= 1
below/not above nor equal
JBE/JNA
(CF
or
ZF) = 1
below
or
equal/not above
JC
CF = 1
carry
JE/JZ
ZF
= 1
equal/zero
JNC CF = 0
not carry
JNE/JNZ
ZF
= 0
not equal/not zero
JNP/JPO
PF
= 0
not parity/parity odd
JP/JPE
PF
= 1
parity/parity even
Signed Conditional Transfers
....
-----:-
C~!'!!!!t!o!'!
T~~t~('I
"Jump If .
..
"
.".IIVIl.V
.......
JG/JNLE
((SF
xor
OF)
or ZF) = 0
greater/not less nor equal
JGE/JNL
(SF
xor
OF)
= 0
greater
or
equal/not
les~
JL/JNGE
(SF
xor
OF)
= 0
less/not greater nor equal
JLE/JNG
((SF xor OF) or ZF) = 1
less
or
equal/not greater
JNO
OF
= 0 not overflow
JNS
SF
= 0
not sign (positive, including
0)
JO
OF
= 1 overflow
JS
SF
= 1
sign (negative)
3-20