IDIV Instruction
IDIV — Signed Integer Division
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8-Bit Signed Division | Divided by Zero | Divide Overflow |
INCLUDE Irvine32.inc .data x SWORD 2001h y SBYTE 80h .code main PROC movsx eax, x idiv y call WriteHex exit main ENDP END main |
INCLUDE Irvine32.inc .data x SWORD -101h y SBYTE 10h .code main PROC mov eax, 0 mov ax, x test y, 0FFh jz ABORT idiv y call WriteHex ABORT: exit main ENDP END main |
INCLUDE Irvine32.inc .data x SWORD -1010h y SBYTE 10h .code main PROC mov eax, 0 mov ax, x idiv y call WriteHex exit main ENDP END main |
| Output | Output | Output |
|
“Argued that winning a silver medal is the worst, as it means being the top loser.” ― Jerry Seinfeld |