programb51 - Step III : Get the second number in BX i.e....

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Appendix B  Explanation : Consider that a word of data is present in the AX register and word of data is present in the BX register, we have to divide word in AX with the word in BX. Using IDIV instruction, divide the contents of two register. Result of division is stored in the AX register. AL contains the quotient and AH contains the remainder. AX = 8000 H 2000 ) 8000 ( 04 BL = 2000 H 8000 Quotient Remainder 0000  Algorithm : Step I : Initialise the data segment. Step II : Get the first number in AX register i.e. dividend.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Step III : Get the second number in BX i.e. divisor. Step IV : Divide the two numbers. Step V : Stop Flowchart : Refer flowchart 51. Flowchart 51 Program : .model small .data a dw 000FH b db 08H .code mov ax, @data ; Initialize data section mov ds, ax mov ax, a ; Load number1 in ax mov bx, b ; Load number2 in bx idiv bx ; divide numbers. Quotient in AL and Remainder in AH end Result : AL = 04 H (quotient) and AH = 00 H (remainder)...
View Full Document

Ask a homework question - tutors are online