8085 program to pack the two unpacked BCD numbers

In this program, we will write an 8085 program to pack the two unpacked BCD numbers in the 8085 microprocessor with a program flow chart and explanation of the program.

8085 program to pack the two unpacked BCD numbers

Program Statement

Write a program to pack the two unpacked BCD numbers. Assume the two unpacked digits are available at memory locations D000H and D001H. Assume that the least significant digit is stored a D000H. Store the result in memory location D002H.

Explanation of Program

  • We have two digits at memory locations D000H and D001H in unpacked BCD form. The LCB is stored at D000H and MSB is stored at D001H.
  • We need to pack the two BCD numbers. i.e. we need to combine the two numbers.
  • To make the digit at D001h as MSB, we will rotate it 4 times to left using RLC instruction. After rotating the digit by 4 times if the digit = 09H, then it will become 90H.
  • Then we will add the two numbers. The result is packed with BCD numbers. Store the result in memory location D002H.
e.g. D001H = 02H, D001H = 09H then the result will be D002H = 92H (result)

Assembly Language Program

InstructionCommentsOperation
LDA D001 HLoad the MSB digit in the accumulatorA = 09H
A = 0000 1001
RLCRotate the number to the left by 1.A = 12H
A = 0001 0010
RLCRotate the number to the left by 1.A = 24H
A = 0010 0100
RLCRotate the number to the left by 1.A = 48H
A = 0100 1000
RLCRotate the number to the left by 1.A = 90H
A = 1001 0000, CY = 0
ANI F0HMake the LSB digit zero.A = 90H
MOV B, AStore the partial result.B = 90H
LDA D000HLoad the LSB BCD digit in the accumulator.A = 02H
ADD BAdd the lower BCD digit to the upper BCD digit.A = 90H + 02H
A = 92H
STA D002HStore the result.D002H = 92H
HLTTermiate program executaion.Stop

Flow Chart of Program

8085 program to pack the two unpacked BCD numbers
Sr. No.Name of the 8085 Programs
1.Write a program to load the data into the accumulator and any register.
2.Write a program to exchange the contents of memory locations.
3.Add two 8-bit numbers.
4.Subtract two 8-bit numbers.
5.Add two 16-bit numbers.
6.Subtract two 16-bit numbers
7.Find the 1’s complement of a Number
8.Find the 2’s complement of a Number
9.8085 Program To Mask The Lower Nibble
10.8085 Program To Mask The Upper Nibble
11.8085 program to pack the two unpacked BCD numbers
12.8085 program to Unpack the two packed BCD numbers
13.8085 program to find the sum of a series of 8-bit numbers
14.8085 Program to sort the numbers in ascending order
15.8085 Program to sort the numbers in Descending order
16.8085 Program to Multiply Two 8-bit Numbers
17.8085 Program to Divide 16-bit number by 8-bit number
18.8085 Program to Find the Number of Negative Numbers in Array
19.8085 Program to Find Maximum Number in Array
20.8085 Program to count the number of 1’s in a register
21.8085 Program to Calculate the sum of a series of even numbers
22.8085 Program to find the square of numbers
23.8085 Program to find the smallest number in the array

Hello friends, my name is Trupal Bhavsar, I am the Writer and Founder of this blog. I am Electronics Engineer(2014 pass out), Currently working as Junior Telecom Officer(B.S.N.L.) also I do Project Development, PCB designing and Teaching of Electronics Subjects.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

telegram logo Join Our Telegram Group!