176
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
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
Flags
Binary Calculations
Section 5-18