181
In the case below, 4F52A6E2 + EC3B80C5 = 13B8E27A7. The sum of the
lower 4-digit addition is a 5-digit number, so CY (SR 25504) = 1, and the sum
of the higher 4-digit addition is incremented by 1.
R: DM 0300
27A7
Au: LR 20
A6E2
Ad: DM 0200
80C5
+
R: DM 0301
3B8E
Au: LR 21
4F52
Ad: DM 0201
EC3B
+
CY = 1
Lower 4 digits. Higher 4 digits.
CY = 1
R+2: DM 0302 R+1: DM 0301 R: DM 0300
00013B8E27A7
5-18-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, AR, DM, HR, LR
SBB(51)
Mi
Su
R
@SBB(51)
Mi
Su
R
When the execution condition is OFF, SBB(51) is not executed. When the
execution condition is ON, SBB(51) subtracts the contents of Su and CY from
Mi and places the result in R. If the result is negative, CY is set and the 2’s
complement of the actual result is placed in R.
Mi – Su – CY CY R
Flags ER: Indirectly addressed DM word is non-existent. (Content of *DM word
is not BCD, or the DM area boundary has been exceeded.)
CY: ON when the result is negative, i.e., when Mi is less than Su plus CY.
EQ: ON when the result is 0.
Example The following example shows eight-digit subtraction. CY is tested following
the first two subtractions to see if the result is negative. If it is, the first result
is subtracted from zero to obtain the true result, which is placed in HR 10 and
Description
Binary Calculations Section 5-18