DIV (BINARY)

DIV, DIVP, DDIV, DDIVP (Binary)

 

DIV instruction divides S1 by S2 and save the result in the Destination (assigned device address).

 

 

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

DIV(P)

DDIV(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

-

 

 

DIV

Function

  • Divide S1 by S2 and save the result to D and the remainder to D+1

 

Example)

If X00 is ON, divide H0AE5(D0) by H0033(D1) and save the result H0036(54) to Y40 and the remainder H0023(35) to Y50.

 

 

 

DDIV

Function

  • Divide S1(double word) by S2(double word) and then save the result to D and D+1 and the remainder to D+2 and D+3.

 

Example)

If X00 is ON, divide H000186A1(D0, D1) by H0000000A(D2, D3) and save the result H00002710(10000) to D4 and D5 and the remainder H00000001(1) to D6 and D7.