Find the 2’s complement of a Number in 8085

In this program, we are going to write an assembly language program to Find the 2’s complement of a Number in 8085 microprocessor with a program flow chart and explanation of the program.

2’s complement of a Number in 8085

Program Statement

Find the 2’s complement of a Number in 8085 stored at memory location C200H and store the complemented number at memory location C3ooH.

Explanation of Program

  • 2’s complement means adding 1 to 1’s complement of that number.
  • We will load the number in the accumulator. Then using CMA instruction we will complement the accumulator. This is 1’s complement of that number.
  • Now we will add 1 to this complemented number to get 2’s complement of that number.
  • Store the result at memory location C300H.
    • Let A = 44 H
    • i.e. A = 0100 0100 (44 H)
    • 1’s complement of A: 1011 1011 ( BB H)
    • Now add + 1 to A
    • 2’s complement of A: 1011 1100 (BC H)
  • The 2’s complement of the number BC H. We will store this result in memory location C300H.

Assembly Language Program

InstructionCommentsOperation
LDA C200HLoad the number in the accumulator store at the memory location C200H.A = 44 H
CMAComplement the numberA = BB H
ADI 01HAdd 1 to the complemented number i.e. 2’s complement of the number.A = BC H
STA C300HStore the resultC300 : BC H
Result
HLTTerminate program executionStop

Flow Chart of Program

flow chart of 2's complement of a Number in 8085
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

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!