Download Print this page

RCA COSMAC User Manual page 27

Hide thumbs Also See for COSMAC:

Advertisement

26
User Manual for the
---------------------------------------------------
BRANCH IF D=OO
I
M(R(P)) -+ R(P).O IF D=OO, OR R(P)+11 BZ
I
When 1=3 and N=2, a conditional branch operation dependent on the value of D is performed. The byte
in D is examined and if it is equal to zero a branch operation is performed. If the value of D is not zero,
R (P) is incremented by 1. This increment causes the branch address byte following the "32" instruction to
be skipped so that the next instruction in sequence is fetched and executed.
This instruction can be used following one of the ALU operations described earlier. For example, an
EXCLUSIVE-OR operation (F3 or FB) might be used to compare an input byte with a byte representing a
constant. A zero result byte in D would represent equality. The "32" instruction could then be used to
branch to a location in the program for handling this value of the input byte when D=OO, or to proceed to
>
the next instruction in sequence if D;O!OO, possibly to look for equality with other constants.
ADDRESS
01
01
01
01
ADD
01
01
01
01
21
22
23
24
RESS
21
22
23
24
M
~
F6
32
97
2C
M
cfu
F6
32
97
2C
A
01
23
R(O)
-
-
R(I)
01
23
I-
R(2)
00
37
R(3)
-
-
A
01
23
R(O)
-
-
R(I)
01
23
I-
R(2)
00
37
R(3)
-
-
N
2
I+-
p
1
X
2
ADDRESS
I
3
01
21
ALU
- I-
02
22
DF=-
1
o
1
00
1
N
2
I-
p
1
X
2
I
3
IALul-
I
DF= -
1
o
112 1
03
23
04
24
CONDITION TRUE
ADD
01
01
01
01
RESS
21
22
23
24
CONDITION FALSE
A
01
23
dJ
M
F6
R(O)
-
-
32
R(I)
01
97
I-
97
R(2)
00
37
2C
R(3)
-
-
~
97
1
A
01
23
c6
M
F6
R(O)
-
-
32
f----
R(l)
01
24
I-
97
R(2)
00
37
2C
R(3)
-
-
N
2
I-
p
1
X
2
I
3
IALul -
I
DF= -
1 0
1
00
1
N
2
I-
p
1
X
2
I
3
IALU
I- I
DF=-
I
0
112 1
Fig. 33 - Example of instruction 32 - BRANCH IF D=OO for both false and true conditions.
BRANCH IF DF
M(R(P)) -+ R(P).O IF DF=1, OR R(P)+1
I
BDF
I
When 1=3 and N=3, branching occurs if DF=1. Otherwise, the next instruction in sequence is performed.
Examples are not shown for the remainder of the branching instructions because they differ only in the
condition tested.
34
BRANCH IF EF1
M(R(P)) -+ R(P).O IF EF1=1, OR R(P)+1
B1
35
BRANCH IF EF2
M(R(P)) -+ R(P).O IF EF2=1, OR R(P)+1
B2
36
BRANCH IF EF3
M(R(P)) -+ R(P).O IF EF3=1, OR R(P)+1
B3
37
BRANCH IF EF4
M(R(P)) -+ R(P).O IF EF4 =1, OR R(P)+1
B4
When 1=3 and N=4,5,6, or 7, branching occurs only when the corresponding external flag mput (EF1 ,2,
3, or 4) is held in its "true" state by external circuits. These four branch instructions permit the micro-
processor to test the flags as required.

Advertisement

loading