8086 program to Multiply two 16 bit numbers




ØØ       Explanation :
·           Consider that a word of data is present in the AX register and 2nd word of data is present in the BX register.
·           We have to multiply the word in AX with the word in BX. Using MUL instruction, multiply the contents of the 2 registers.
·           The multiplication of the two 16 bit numbers may result into a 32 bit number. So result is stored in the DX and AX register.



ØØ       Explanation :
·           Consider that a word of data is present in the AX register and 2nd word of data is present in the BX register.
·           We have to multiply the word in AX with the word in BX. Using MUL instruction, multiply the contents of the 2 registers.
·           The multiplication of the two 16 bit numbers may result into a 32 bit number. So result is stored in the DX and AX register.

8086 program to Subtract two 16 bit numbers



ØØ       Explanation :
·            Consider that a word of data is present in the AX register and second word of data is present in the BX register.
·            We have to subtract the word in BX with the word AX.
·            Using subtract (SUB) instruction, subtract the contents of two registers.
·            Result will be stored in the AX register.
·            Display the result using display routine.


ØØ       Explanation :
·            Consider that a word of data is present in the AX register and second word of data is present in the BX register.
·            We have to subtract the word in BX with the word AX.
·            Using subtract (SUB) instruction, subtract the contents of two registers.
·            Result will be stored in the AX register.
·            Display the result using display routine.

8086 program to Add two 16 bit numbers



ØØ       Explanation :
·            Consider that a word of data is present in the AX register and a 2nd word of data is present in the BX register.
·            We have to add word in AX with the word in BX. Using ADD instruction, add the contents.
·            Result will be stored in the AX register. Display the result using display routine.




ØØ       Explanation :
·            Consider that a word of data is present in the AX register and a 2nd word of data is present in the BX register.
·            We have to add word in AX with the word in BX. Using ADD instruction, add the contents.
·            Result will be stored in the AX register. Display the result using display routine.


8086 program to Divide 16 bit numbers by an 8 bit numbers



ØØ       Explanation :
·            Consider that a word of data is present in the AX register and byte of data is present in the BL register, we have to divide word in AX with the byte in BL.
·            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.


ØØ       Explanation :
·            Consider that a word of data is present in the AX register and byte of data is present in the BL register, we have to divide word in AX with the byte in BL.
·            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.

8086 program to Add two 16 bit BCD numbers



ØØ       Explanation :
·            Consider that two words are available in registers AX and BX. We have to add these two words.
·            Using add instruction, add the contents, of the lower two bits i.e. add AL and BL.
·            The result of this addition is stored in the AL register.
·            DAA instruction is then used to convert the result to valid BCD. Now, add the contents of MSB alongwith carry if generated in LSB addition.


ØØ       Explanation :
·            Consider that two words are available in registers AX and BX. We have to add these two words.
·            Using add instruction, add the contents, of the lower two bits i.e. add AL and BL.
·            The result of this addition is stored in the AL register.
·            DAA instruction is then used to convert the result to valid BCD. Now, add the contents of MSB alongwith carry if generated in LSB addition.

8086 Program to multiply two 8 bit BCD numbers



ØØ       Explanation :
·            Consider that two unpacked numbers are present in the AL and BL registers. We have to multiply the two numbers. The result is stored in the AX register. The AAM (BCD adjust after Multiply) is used to adjust the product to two unpacked BCD digits in AX.



ØØ       Explanation :
·            Consider that two unpacked numbers are present in the AL and BL registers. We have to multiply the two numbers. The result is stored in the AX register. The AAM (BCD adjust after Multiply) is used to adjust the product to two unpacked BCD digits in AX.

8086 program to Subtract 8 bit BCD numbers



ØØ       Explanation :
·           Consider that a byte of data is present in the AL register and a second byte of data is present in the BL register. We have to subtract byte in BL with byte in AL. Using SUB instruction, we will subtract the contents. The result is stored in the AL register. Using DAS instruction we will make sure that the result is valid BCD.


ØØ       Explanation :
·           Consider that a byte of data is present in the AL register and a second byte of data is present in the BL register. We have to subtract byte in BL with byte in AL. Using SUB instruction, we will subtract the contents. The result is stored in the AL register. Using DAS instruction we will make sure that the result is valid BCD.