WDIV (BINARY)
WDIV, WDIVP, DWDIV, DWDIVP (Binary)
WDIV instruction divides S1 by S2 and save the result in the Destination (assigned device address) and delete the remainder.
| |
S1 | Value of the dividend |
S2 | Value of the Divisor |
D | Destination |
Instruction | Device address | No. of Steps | Flag | |||||||||||||||
M | X | Y | K | L | F | T | C | S | Z | D | @D | Int. |
| Error | Zero | Carry | ||
WDIV(P) DWDIV(P) | S1 | o | o | o | o | o | o | o | o | - | o | o | o | o | 4 | o | - | - |
S2 | o | o | o | o | o | o | o | o | - | o | o | o | o | |||||
D | o | - | o | o | o | - | o | o | - | o | o | o | - |
WDIV
Function
Divide S1 by S2 and save the result to D and delete the remainder.
Example)
If X00 is ON, divide 456(D0) by 123(D10) and save the result 3 to D30 and delete remainder.
DWDIV
Function
Divide S1(double word) by S2(double word) and then save the result to D and D+1 and delete the remainder.
Example)
If X00 is ON, divide H27ED2445(D100, D101) by H000A23C0(D200, D201) and save the result H000003F0(1,008) to D300 and D301 and delete the remainder.