
103
Au + Ad + CY
CY
R
ER:
Au and/or Ad is not BCD.
Indirectly addressed DR word is non-existent. (Content of
*
DR word
is not BCD, or the DR area boundary has been exceeded.)
CY:
ON when there is a carry in the result.
EQ:
ON when the result is 0.
If 0002 is ON, the program represented by the following diagram clears CY
with CLC(44), adds the content of LR 25 to a constant (6103), places the re-
sult in DR 0100, and then moves either all zeros or 0001 into DR 0101 de-
pending on the status of CY (0312). This ensures that any carry from the last
digit is preserved in R+1 so that the entire result can be later handled as
eight-digit data.
0002
CLC(44)
ADD(40)
LR 25
#6103
DR 00
Address
Instruction
Operands
000
LD
0002
001
CLC(44)
002
AND(40)
LR
25
#
6103
DR
00
003
AND
0312
004
AND(40)
#
0000
#
0000
DR
01
ADD(40)
#0000
#0000
DR 01
0312
CY
3-7-29
BCD SUBTRACT - SUB(41)
Mi: Minuend word (BCD)
I/O, work, dedicated (03 only), DR, LR, TC, #
Su: Subtrahend word (BCD)
I/O, work, dedicated (03 only), DR, LR, TC, #
Ladder Symbol
Operand Data Areas
R: Result word
Output bits, work bits, DR, LR
SUB(41)
Mi
Su
R
When the execution condition is OFF, SUB(41) is not executed. When the
execution condition is ON, SUB(41) 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
10’s complement of the actual result is placed in R. To convert the 10’s com-
plement to the true result, subtract the content of R from zero (see example
below).
Mi – Su – CY
CY
R
ER:
Mi and/or Su is not BCD.
Indirectly addressed DR word is non-existent. (Content of
*
DR word
is not BCD, or the DR 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.
Flags
Example
Description
Flags
Instruction Set
Section 3-7