DIV

DIVIDEDIV

Operation:

(temp) - (NUMR)

if (temp) I (DIVR) >MAX then the following, in sequence (QUO), (REM) undefined

(SP) - (SP) - 2

((SP) +1:(SP)) - FLAGS

(IF) - 0

(TF) -0

(SP) - (SP) - 2

((SP) +1:(SP)) - (CS)

(CS) - (2) i.e., the contents of memory locations 2 and 3

(SP) - (SP) - 2 ((SP) + 1:(SP)) - (IP)

(IP) - (0) i.e., the contents of locations 0 and 1

else

(QUO) - (temp) I (DIVR), where I is unsigned division

(REM) - (temp) % (DIVR) where

%is unsigned modulo

Flags Affected:

AF, CF, OF, PF, SF, ZF undefined

Description:

DIV source

DIV (divide) performs an unsigned division of the accumulator (and its extension) by the source operand. If the source operand is a byte, it is divided into the two-byte dividend assumed to be in registers AL and AH. The byte quotient is returned in AL, and the byte remainder is returned in AH. If the source operand is a word, it is divided into the two- word dividend in registers AX and DX. The word quotient is returned in AX, and the word

remainder is returned in DX. If the quotient exceeds the capacity of its destination register (FFH for byte source, FFFFH for word source); as when division by zero is attempted, a type 0 interrupt is generated, and the quotient and remainder are undefined. Nonin- tegral quotients are truncated to integers. The content of AF, CF, OF, PF, SF and ZF is un- defined following execution of DIV.

2-73

Page 108
Image 108
Intel 210200-002 manual Dividediv