2-169
2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
Symbol Math Instructions
2
–/–L
Subtraction at (1)
Subtraction at (2)
Final Subtraction Result
Sample program
If the result of the subtraction is a negative number (Mi<Su or Mi+1, Mi <Su+1, Su), the result is output
as the 2’s complement and the Carry Flag (CY) will turn ON to indicate that the result of the subtraction
is negative. To convert the 2’s complement to the true number, an instruction which subtracts the result
from 0 is necessary using the Carry Flag (CY) as an execution condition.
2
B
0
8
F
A
5
3
5
6
A
0
1
E
0
3
Mi+1: CIO 201
CY
Mi: CIO 200
Su+1: CIO 121 Su: CIO 120
6 8 5 1 F 9 2 D1
R+1: D101 R+1: D100
The Carry Flag (CY) is ON, so the result is subtracted from 0000 0000 to
obtain the actual number.
0 0 0 0 0 0 0 0
CY
Su+1: D101 Su: D100
9 7 A E 0 6 D 31
R+1: D101 R+1: D100
6 8 5 1 F 9 2 D
CY
9 7 A E 0 6 D 31
R+1: D101 R+1: D100
6 8 5 1 F 9 2 D
Mi+1: CIO 201 Mi: CIO 200
2 0 F 5 5 A 1 0
Su+1: D101 Su: D100
The Carry Flag (CY) is turned ON, so the actual number is –97AE06D3.
Because the content of D101 and D100 is negative, CY is used to turn
ON CIO 21.00 to indicate this.
0.00
When CIO 0.00 is ON in the following example, D110 will be
subtracted from D100 as 4-digit signed binary values and the
result will be output to D120.
0.00
When CIO 0.00 is ON in the following example, D111 and D110
will be subtracted from D101 and D100 as 8-digit signed binary
values and the result will be output to D121 and D120.
−
D100
D110
D120
−L
D100
D110
D120