6 BASIC INSTRUCTIONS
6.3 Data Conversion Instructions
287
6
Complement of 2 of BIN 16-bit data (sign inversion), complement
of 2 of BIN 32-bit data (sign inversion)
NEG(P), DNEG(P)
■NEG
• Reverses the sign of the 16-bit device designated by (D) and stores at the device designated by (D).
• Used when reversing positive and negative signs.
■DNEG
• Reverses the sign of the 32-bit device designated by (D) and stores at the device designated by (D).
• Used when reversing positive and negative signs.
• There is no operation error in the NEG(P) or DNEG(P) instruction.
(D): Head number of the devices where the data for which complement of 2 is performed is stored (BIN 16/32 bits)
Setting
data
Internal device R, ZR J\ U\G Zn Constant Others
Bit Word Bit Word
(D)
Basic
Process
High
performance
Redundant
Universal
LCPU
Command
Command
P
NEG, DNEG
NEGP, DNEGP
D
D
indicates an instruction symbol of NEG/DNEG.
16 bit
Before execution
Sign conversion
b15
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
b0
0
0 0 0 0 0 0 0 0 0 0 0 0 000
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
b15
1 1 1 1 1 1 1
b0
-21846
0000000
1
D
D
0
After execution
21846
32 bit
b31
1
Before
execution
1 1 1 1 1 1
0
1
0 0
1
00
b0
000 0 0 0 0 0 0 0 0 0 00
111 1 1 1 1 0 1 0 0 1 00
1
b31
0 0 0 1 1 1 0
b0
Sign
conversion
-
After
execution
0000 010
D
D
-218460
218460