220
The following example shows a four-digit addition with CY used to place either
#0000 or #0001 into R+1 to ensure that any carry is preserved.
CLC(41)
00000
ADB(50)
010
DM 0100
HR 10
MOV(21)
#0000
HR 11
MOV(21)
#0001
HR 11
TR 0
25504
25504
= R
= R+1
= R+1
Address Instruction Operands
00000 LD 00000
00001 OUT TR 0
00002 CLC(41)
00003 ADB(50)
010
DM 0100
HR 10
00004 AND NOT 25504
00005 MOV(21)
# 0000
HR 11
00006 LD TR 0
00007 AND 25504
00008 MOV(21)
# 00001
HR 11
In the case below, A6E2 + 80C5 = 127A7. The result is a 5-digit number, so CY
(SR 25504) = 1, and the content of R + 1 becomes #0001.
R+1: HR 11 R: HR 10
000127A7
Au: IR 010
A6E2
Ad: DM 0100
80C5
+
Note The UF and OF flags would also be turned ON during this addition, but they can
be ignored since they are relevant only in the addition of signed binary data.
In the following example, ADB(50) is used to add two 16-bit signed binary val-
ues. (The 2’s complement is used to express negative values.)
The effective range for 16-bit signed binary values is –32,767 (8000) to +32,768
(7FFF). The overflow flag (OF: SR 25404) is turned ON if the result exceeds
+32,768 (7FFF) and the underflow flag (UF: SR 25405) is turned ON if the result
falls below –32,767 (8000).
CLC(41)
00000
ADB(50)
LR 20
DM 0010
DM 0020
Address Instruction Operands
00000 LD 00000
00001 CLC(41)
00002 ADB(50)
LR 20
DM 0010
DM 0020
Example 1:
Adding Normal Data
Example 2:
Adding Signed Binary Data
Binary Calculations Section 5-20