Specifications

Description: Adds the source operand to the destination operand and stores
the re&lt at the destination address. The original contents-of the destination
are lost. Ttr, ktmcI of the sowe are not a#ectod. Two’s cwpt addi-
tion is perfoti.
The ADD instruction inckdes as special cases the “add-to-register,” “add-t@
memory,” and ‘Md-reister-to-rwister” functions:
Add-to&gister
ADD WC, R ,
A&l-to*mory
ADD R, +t
Add Register-to-Register ADD RA. RB
Arithmetic may also be done directly in memory by the general form ADD
instruction
ADD src, dst
.
Use of this form saves considerable loadindand storing of accumulators.
Two special cases of the ADD instruction are particularly useful in coppilers,
interpreters, and other stack arithmeti processes:
ADD (R +,
II
(RI
(where R is th stack pointer)
which replaces the top two elements ‘pf the stack with their sum; and ADD
src. (R), which increases the top eletient of the stack by the contents of
the source address.
The “Add Immediate” operation is y&t another special case of this general-
ized .ADD iristruction:
ADD #n, dst *
Immediate operations are useful in dealing with constant operinds. Note
that:
ADD #n. R
steps the register R (which may be an index register) through n addresses
eliminating the need for a special “add-to-index register” instruction.
All these special cases of the ADD instruction apply equally well to the other
double operand instruetions that follow.
suBtract
SUB WC, drt
2.3 YI
1 , 6
I t I
WC
I I t II t
drt
I I t I
15
12 11 6 5
0
Operation: (dst) - (src) + (dst) [in detail, (dst) + - (src) + 1 + (dst)]
Condition Codes: 2: set if result = 0; cleared otherwise
N: set if result < 0; cleared otherwise
C: cleared if there was a carry from the most significant
bit of the result: set othen@se
4
V: set if there was arithmetic overflow as a result of the
operation, that is, if-the operands were of opposite
signs and the sign of source was the Same as the
sign of the result; cleared otherwise.
Description: Subtract; the source operand from the destination operand and
leaves the result at the destination address. The original contents of the
destination are lost. The contents of the source are not affected.
19