7-22
Section
Binary Calculation Instructions
468
Example
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)
200
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)
200
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
0
0
0
1
2
7
A
7
Au: IR 200
A
6
E
2
Ad: DM 0100
8
0
C
5
+
Note
For signed binary calculations, the status of the UF and OF flags indicate wheth-
er the result has exceeded the signed binary data range (–32,768 (8000) to
+32,767 (7FFF)).
7-22-2 BINARY SUBTRACT – SBB(51)
Mi
: Minuend word (binary)
IR, SR, AR, DM, HR, TC, LR, #
Su
: Subtrahend word (binary)
IR, SR, AR, DM, HR, TC, LR, #
Ladder Symbols
Operand Data Areas
R
: Result word
IR, SR, AR, DM, HR, LR
SBB(51)
Mi
Su
R
@SBB(51)
Mi
Su
R
DM 6144 to DM 6655 cannot be used for R.
Limitations