Download Microcontroller User`s Manual

Transcript
INSTRUCTION SET REFERENCE
DIV AB
Function:
Divide
Description:
Divides the unsigned 8-bit integer in the accumulator by the unsigned 8-bit integer in register
B. The accumulator receives the integer part of the quotient; register B receives the integer
remainder. The CY and OV flags are cleared.
Exception: if register B contains 00H, the values returned in the accumulator and register B
are undefined; the CY flag is cleared and the OV flag is set.
Flags:
CY
AC
OV
N
Z
0
—
✓
✓
✓
CY
AC
OV
N
Z
0
—
1
?
?
For division by zero:
Hex Code in:
Binary Mode = [Encoding]
Source Mode = [Encoding]
Example:
The accumulator contains 251 (0FBH or 11111011B) and register B contains 18 (12H or
00010010B). After executing the instruction
DIV AB
the accumulator contains 13 (0DH or 00001101B); register B contains 17 (11H or
00010001B), since 251 = (13 X 18) + 17; and the CY and OV flags are clear.
Binary Mode
Source Mode
Bytes:
1
1
States:
10
10
[Encoding]
1000
0100
Hex Code in:
Binary Mode = [Encoding]
Source Mode = [Encoding]
Operation:
DIV
(A) ← quotient (A)/(B)
(B) ← remainder (A)/(B)
A-59