byte division
TRANSCRIPT
![Page 1: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/1.jpg)
PRESENTED TO:
MAM SANIYA
![Page 2: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/2.jpg)
COOL GROUP SAIRA ZAHEER 1430314 MAIRA JUNAID 1430297 RABICA AFZAL 1430309
![Page 3: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/3.jpg)
OUTLINE
• DIVISION
• DIV
• IDIV
• WORD FORM
• BYTE FORM
• DIVIDE OVERFLOW
• EXAMPLES
• SIGN EXTENSION OF DIVIDEND
• WORD DIVISION
• BYTE DIVISION
• EFFECT OF FLAG
• CONCLUSION
![Page 4: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/4.jpg)
DIVISIONTHERE ARE TWO DIVISON OPERATORS:
• DIV (UNSIGNED DIVIDE)
• IDIV(SIGNED DIVIDE)
• SYNTAX: DIV divisor & IDIV divisor
• BYTE FORM: Divisor is in 8-bit register.The 16-bit dividend is in AX
• RESULT OF BYTE FORM:8-bit Quotient is in AL.8-bit Remainder is in AH
![Page 5: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/5.jpg)
WORD FORM:
Divisor is a 16-bit register. The 32-bit dividend is in DX:AX
RESULT OF WORD FORM:16-bit Quotient is in AX.16-bit Remainder is in DX
DIVISOR NOT BE A CONSTANT
![Page 6: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/6.jpg)
DIVIDE OVERFLOW
If the divisor is much smaller than the dividend, the Quotient will be too big to fit in the specified destination that is AL or AX .It gives error “DIVIDE OVERFLOW”
![Page 7: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/7.jpg)
EXAMPLE OF DIVIDE OVERFLOWSUPPOSE AX CONTAINS 00FBH AND BL CONTAINS FFH
instruction Decimal quotient
Decimal Reminder
AX AL
DIV BL 0 251 FB 00
IDIV BL DIVIDE OVERFLOW
![Page 8: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/8.jpg)
EXAMPLE OF DIV SUPPOSE DX CONTAINS 0000H,AX CONTAINS 0005H,AND BX CONTAINS 0002H 0002H.
Instruction Decimal quotient
Decimal remainder
AX DX
DIV BX 2 1 0002 0001
![Page 9: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/9.jpg)
EXAMPLE OF IDIV SUPPOSE DX CONTAINS 0000H,AX CONTAINS 0005H,AND BX CONTAINS FFFEH
instruction Decimal quotient
Decimal remainder
AX DX
IDIV BX -2 1 FFFE 0001
![Page 10: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/10.jpg)
SIGN EXTENSION OF THE DIVIDEND
• WORD DIVISIONFOR DIV,DX should be cleared.FOR IDIV,DX should sign extension of
AX. The instruction CWD will do the extension.
![Page 11: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/11.jpg)
EXAMPLE OF WORD DIVISIONDIVIDE-1250 BY 7
• MOV AX,-1250 ;AX gets dividend• CWD ;Extend sign to DX• MOV BX,7 ;BX has divisor• IDIV BX ;AX gets quotient, ;DX has remainder
![Page 12: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/12.jpg)
BYTE DIVISION
FOR DIV,AH should be cleared.FOR IDIV,AH should the sign extension of
AL. The instruction CBW (Convert byte to word) will do the extension.
![Page 13: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/13.jpg)
EXAMPLE OF BYTE DIVISIONDIVIDE THE SIGNED VALU OF THE BYTE VARIABLE XBYTE BY -7
• MOV AL,XBYTE ;AL has dividend• CBW ;Extend sign to AH• MOV BL,-7 ;BL has divisor• IDIV BL ;AL has quotient,AH
has remainder
![Page 14: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/14.jpg)
EFFECT OF FLAGES
THERE IS NO EFFECT OF CBW AND CWD ON THE FLAGS
![Page 15: Byte division](https://reader033.vdocuments.mx/reader033/viewer/2022061608/5876404a1a28ab68098b8323/html5/thumbnails/15.jpg)
THANKS FOR YOUR ATTENTIONSPECIAL THANX TO MOMINA FOR HELPING US IN PREPARATION