
Chapter 5. Application instructions
5-54
5.8.6
DIVS, DIVSP, DDIVS, DDIVSP
DIVS
(Signed binary
divide)
FUN(124) DIV
FUN(126) DDIV
FUN(125) DIVP
FUN(127) DDIVP
Applicable
CPU
K200S
K300S
K1000S
Available Device
Flag
Instructions
M
P
K
L
F
T
C
S
D
#D Integer
Steps
Error
(F110)
Zero
(F111)
Carry
(F112)
O O O O O O O
O
O
O
O O O O O
O
O
O
O
O
DIVS(P)
DDIVS(P)
O O O O*
O O
O O
7/9/11
O
O
* Available only when do not use computer link module or data link module
1) Functions
-
DIVS(P) : Performs the division of the signed BIN data specified as [ S1 ] and the signed BIN data
specified as [ S2 ], and stores the division result into the device specified as [ D+1, D ]. The quotient
is stored at [ D ], and the remainder is stored at [ D+1 ].
-
DDIVS(P) : Performs the division of the signed BIN data specified as [ S1+1, S ] and the signed BIN
data specified as [ S2+1, S2 ], and stores the division result into the device specified as [ D+3, D+2,
D+1, D ]. The quotient is stored at [ D+1, D ], and the remainder is stored at [ D+3, D+2 ].
-
If the quotient is zero, the zero flag will be set.
-
If indirect address specified by #D format is out of device range or the content of divider is 0, the
operation error occurs and the error flag (F110) is set.
-
The sign of quotient and remainder is as following table;
Quotient
Remainder
+ (positive)
+ (positive)
+ (positive)
+ (positive)
+ (positive)
– (negative)
– (negative)
+ (positive)
– (negative)
+ (positive)
– (negative)
– (negative)
– (negative)
– (negative)
+ (positive)
– (negative)
Operand setting
DIVS
DIVSP
DDIVS
DDIVSP
S1
S1
S2
S2
S1
S2
D
D
D
The device storing dividend
The device at which the
division result is stored
S1
S2
D
The device storing divider
S1
S2