Download Print this page

RCA COSMAC User Manual page 23

Hide thumbs Also See for COSMAC:

Advertisement

22
User Manual for the
ALU Operations Using M(R(P))
In this group of ALU instructions, the N digit has a 1 in the high-order bit position. The remaining three
bits of N are a code specifying the same ALU operation as instructions using M( R (X)
l.
except when N=6.
In general, R (P) points to one of the operands, the byte in memory after the instruction byte, called the
immediate byte. The D register supplies the second operand, and then receives the result.
The use of immediate data is a useful way to avoid setting up special constant areas in memory and
pointers to them.
LOAD IMMEDIATE
M(R(P))
-+
D; R(P)+1
I
LDI
I
When I=F and N=8, the memory byte immediately following the current instruction byte replaces the
byte in D. Because the current program counter represented by R(P) is incremented again by 1 during the
execution ofthis instruction, the instruction byte following the immediate byte placed in D will be fetched
next.
This instruction is one of three which load D from memory. It uses R(P) as a pointer, while LDA uses
R(N) and LDX uses R(X). LDI and LDA each increment the pointer after use, but LDX does not.
A
03
28
N
8
6
i+-
p
0
X
2
ADDK~SS
M
I
F
03
27
F8
RIO)
03
28
I-
03
28
92
R(1)
00
71
IALUI-
I
A
03
28
N
8
cb
-
p
0
X
2
ADDRESS
M
I
F
03
27
F8
--
RIO)
03
29
I-
03
28
92
R(1)
00
71
IALUI,-
1
03
29
F9
R(2)
00
33
OF
=-
03
29
F9
R(2)
00
33
OF
= -
03
2A
57
R(3)
-
-
I
o
121 1
03
2A
57
R(3)
-
-
0
92
I--
+
92
Fig. 23 - Example of instruction F8 - LOAD IMMEDIA TE.
OR IMMEDIATE
M(R(P)) v D
-+
D; R(P)+1
ORI
When I=F and N=9, a logical OR operation is performed similar to F1. The D byte is one operand, and
the memory byte immediately following the F9 instruction is the second operand. The result goes to D.
A
03
2A
N
9
6
i+-
p
0
ADDKbS
X
2
M
-
I
F
03
27
F8
RIO)
03
2A
03
28
92
Rill
00
71
ALU
(V)
A
03
2A
N
9
cb
I-
p
0
X
2
ADDRESS
M
--
28
I--
I
F
03
27
F8
RIO)
03
03
28
92
R(1)
00
71
ALU
(V)
03
29
F9
R(2)
00
33
OF
= -
t
03
29
F9
R(2)
00
33
OF
=-
+
03
2A
57
R(3)
-
-
0
92
03
2A
57
R(3)
-
-
0
07
~
57
Fig.
24 -
Example of instruction F9 - OR IMMEDIA TE.

Advertisement

loading