103 / 132 page

HT80C51 User Manual
80C51 Family Instruction Set – Instruction definitions
Handshake Solutions
© Philips Electronics N.V. 2005
Page 103 of 132
DIV AB
Function: Divide
Description: DIV AB divides the unsigned eight-bit integer in the Accumulator by the unsigned eight-bit integer
in register B.
The Accumulator receives the integer part of the quotient; register B receives the integer remain-
der. The carry and OV flags will be cleared.
Exception: if B had originally contained 00H, the values returned in the Accumulator and B-
register will be undefined and the overflow flag will be set. The carry flag is cleared in any case.
Example: The Accumulator contains 251 (0FBH or 11111011B) and B contains 18 (12H or 00010010B).
The instruction,
DIV AB
will leave 13 in the Accumulator (0DH or 00001101B) and the value 17 (11H or 00010001B) in B,
since 251 = (13 x 18) + 17. Carry and OV will both be cleared.
Bytes: 1
Cycles: 4
Encoding:
Operation: DIV
(A)15-8
← (A)/(B)
(B)7-0
1
0
0
0
0
1
0
0