Intel 80286 Computer Accessories User Manual


 
BASIC INSTRUCTION SET
3.3.4
Division Instructions
DIV
(Unsigned Integer Divide) performs an unsigned division
of
the accumulator by the source operand.
If
the source operand
is
a byte, it
is
divided into the double-length dividend assumed to be in registers
AL
and
AH
(AH
= most significant byte; AL = least significant byte).
The
single-length quotient
is
returned
in
AL, and the single-length remainder
is
returned in AH.
If
the source operand
is
a word, it
is
divided into the double-length dividend
in
registers
AX
and
DX.
The
single-length quotient
is
returned
in
AX, and the single-length remainder
is
returned in DX. Non-
integral quotients are truncated to integers toward
O.
The remainder
is
always less than the quotient.
For unsigned byte division, the largest quotient
is
255. For unsigned word division, the largest quotient
is
65,535. DIY leaves OF,
SF,
ZF,
AF, PF, and
CF
undefined. Interrupt
(INT
0) occurs if the divisor
is
zero or if the quotient
is
too large for
AL
or AX.
Example:
DIY
BX. Replaces the contents
of
AX with the unsigned quotient
of
the doubleword value
contained
in
DX
and AX, divided by BX.
The
unsigned modulo replaces the contents of
DX.
Example:
DIY
BL. Replaces the contents of AL with the unsigned quotient
of
the word value in AX,
divided by BL.
The
unsigned modulo replaces the contents
of
AH.
IDIV
(Signed Integer Divide) performs a signed division of the accumulator by the source operand.
IDlY
uses the same registers as the
DIY
instruction.
For signed byte division, the maximum positive quotient
is
+ 127 and the minimum negative quotient
is
-128.
For signed word division, the maximum positive quotient.is + 32,767 and the minimum negative
quotient
is
- 32,768. Non-integral results are truncated towards
O.
The
remainder will always have the
same sign as the dividend and will be less than the divisor in magnitude.
IDlY
leaves OF, SF,
ZF,
AF,
PF,
and
CF
undefined. A division by zero causes an interrupt
(INT
0) to occur
if
the divisor
is
0 or if
the quotient
is
too large for
AL
or AX.
Example:
IDlY
WORDOPRND.
Replaces the contents
of
AX with the signed quotient of the double-
word value contained in
DX
and AX, divided by the value contained in the memory word
labeled
WORDOPRND.
The signed modulo replaces the contents
of
DX.
3.4
LOGICAL INSTRUCTIONS
The
group
of
logical instructions includes the Boolean operation instructions, rotate and shift instruc-
tions, type conversion instructions, and the no-operation (NOP)instruction.
3.4.1 Boolean Operation Instructions
Except for the
NOT
and
NEG
instructions, the Boolean operation instructions can use two register
operands, a general purpose register operand with a memory operand, an immediate operand with a
general purpose register operand, or a memory operand. The
NOT
and
NEG
instructions
are
unary
operations
that
use a single operand
in
a register or memory.
AND
(And) performs the logical
"and"
of
the operands (byte or word) and returns the result to
the
destination operand.
AND
clears
OF
and DF, leaves
AF
undefined, and updates SF,
ZF,
and PF.
3-9