Slide 15.5: DIV instruction Slide 15.7: IDIV instruction (cont.) Home |
IDIV
Instruction
IDIV
(signed divide) instruction performs signed integer division, using the same operands as the DIV
instruction.
IDIV — Signed Integer Division |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
8-Bit Signed Division | Divided by Zero | Divide Overflow |
.data x SWORD 2001h y SBYTE 80h .code movsx eax, x idiv y call WriteHex |
.data x SWORD -101h y SBYTE 10h .code mov eax, 0 mov ax, x test y, 0FFh jz ABORT idiv y call WriteHex ABORT: exit |
.data x SWORD -1010h y SBYTE 10h .code mov eax, 0 mov ax, x idiv y call WriteHex |
Output | Output | Output |