programb52 - AX = 0000 0100 0000 0111 = 0407 H Algorithm...

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 in unpacked BCD and byte of data is present in the BL register, we have to divide word in AX with the byte in BL. The AAD is before the division is perfomed to adjust the result after division to unpacked BCD. Using DIV 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. eg. AX = 0000 0110 0000 0111 = unpacked BCD 67 BL = 0000 1001 = unpacked BCD 9 AAD AX = 0000 0000 0100 0011 = 0043 H . DIV BL AX / BL Result in AX.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: AX = 0000 0100 0000 0111 = 0407 H Algorithm : Step I : Initialise the data segment. Step II : Get the first number in AX register i.e. dividend. Step III : Get the second number in BL i.e. divisor. Step IV : Divide the two numbers. Step V : Stop Flowchart : Refer flowchart 52. Program : .model small .data a dw 0144H b db 12H .code mov ax, @data ; Initialize data section mov ds, ax mov ax, a ; Load number1 in ax mov bl, b ; Load number2 in bl div bl ; divide numbers. Quotient in AL and Remainder in AH end Flowchart 52 Result : AL = 07 H (quotient) and AH = 04 H (remainder)...
View Full Document

Ask a homework question - tutors are online