CPU16
REFERENCE MANUAL
INSTRUCTION SET
MOTOROLA
5-13
Note
The numeric range of short branch offset values is $80 (–128) to $7F
(127), but actual displacement from the instruction differs from the
range for two reasons.
First, PC values are automatically aligned to word boundaries. Only
even offsets are valid — an odd offset value is rounded down. Maxi-
mum positive offset is $7E.
Second, instruction pipelining affects the value in the PC at the time
an instruction executes. The value to which the offset is added is the
address of the instruction plus $0006. At maximum positive offset
($7E), displacement from the branch instruction is 132. At maximum
negative offset ($80), displacement is –122.
5.6.2 Long Branch Instructions
Long branch instructions operate as follows. When a specified condition is met, a
signed 16-bit offset is added to the value in the program counter. If addition causes the
value in the PC to be greater than $FFFF or less than $0000, the PK extension field is
incremented or decremented. Program execution continues at the new extended ad-
dress. Long branches are used when large displacements between decision-making
steps are necessary.
Long branch instructions can be classified by the type of condition that must be satis-
fied in order for a branch to be taken. Some instructions belong to more than one clas-
sification.
Unary branch instructions always execute.
Simple branches are taken when a specific bit in the condition code register is in a spe-
cific state as a result of a previous operation.
Unsigned branches are taken when comparison or test of unsigned quantities results
in a specific combination of condition code register bits.
Signed branches are taken when comparison or test of signed quantities results in a
specific combination of condition code register bits.
Signed Branches
Opcode
B7
BC
BE
BF
BD
B6
Mnemonic
BEQ
BGE
BGT
BLE
BLT
BNE
Equation
Z
=
1
N
⊕
V
=
0
Z
(N
⊕
V)
=
0
Z
(N
⊕
V)
=
1
N
⊕
V
=
1
Z
=
0
Condition
(X)
=
(M)
(X)
≥
(M)
(X)
>
(M)
(X)
≤
(M)
(X)
<
(M)
(X)
≠
(M)
Table 5-20 Short Branch Summary (Continued)
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.