
Instruction Set
4-50
DIV
Divide Unsigned Numbers
DIV
What It Does
DIV divides one unsigned number by another unsigned number.
Syntax
Description
DIV operates on unsigned numbers. The operand you specify is the divisor. DIV assumes
that the number to be divided—the dividend—is in AX or DX::AX. (DIV uses a dividend that
is twice the size of the divisor.)
DIV replaces the high half of the dividend with the remainder and the low half of the dividend
with the quotient. If the quotient is too large to fit in the low half of the dividend (such as
when dividing by 0), DIV generates Interrupt 0 instead of setting CF. DIV truncates
nonintegral quotients toward 0.
Operation It Performs
Form
Opcode
Description
Clocks
Am186 Am188
DIV
r/m8
F6
/6
AL=AX/(r/m byte); AH=remainder
29/35
29/35
DIV
r/m16
F7
/6
AX=DX::AX/(r/m word); DX=remainder
38/44
38/48
DIV
divisor
if (size(
divisor) == 8)
/* unsigned byte division */
{
temp = AX /
divisor;
if (size(temp) > size(AL))
/* quotient too large */
interrupt(0);
else
{
AH = AX %
divisor;
/* remainder */
AL = temp;
/* quotient */
}
}
if (size(
divisor) == 16)
/* unsigned word division */
{
temp = DX::AX /
divisor;
if (size(temp) > size(AX))
/* quotient too large */
interrupt(0);
else
{
DX = DX::AX %
divisor;
/* remainder */
AX = temp;
/* quotient */
}
}
Summary of Contents for Am186 Series
Page 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Page 10: ...Table of Contents x...
Page 18: ...Programming 1 8...
Page 40: ...Instruction Set Listing 3 14...