Program to find 2’s complement of an 8-bit number

Q. Write an 8085 program and draw a flow chart to find 2’s complement of an 8-bit number.(8085 Microprocessor Program)



Address Mnemonics Operand Opcode Comments
2000 LDA 3000H 3A Load H-L pair with data from 3000H.
2001     00  
2002     30  
2003 CMA   2F Complement accumulator.
2004 INR A 2C Increment accumulator.
2005 STA 3001H 32 Store the result at memory location 3001H.
2006     01  
2007     30  
2008 HLT   76 Halt


Before Execution:

3000H:    85H

After Execution:

3001H:     7BH

Program Explanation

  1. This program finds the 2’s complement of an 8-bit number stored in memory location 3000H.
  2. Let us assume that the operand stored at memory location 3000H is 85H.
  3. The operand is moved to accumulator from memory location 3000H.
  4. Then, its complement is found by using CMA instruction.
  5. One is added to accumulator by incrementing it to find its 2’s complement.
  6. The result is stored at memory location 3001H.

3 thoughts on “Program to find 2’s complement of an 8-bit number”

  1. How we store 85 in 3000H?,then only we can find the correct result, right? . Pls give me an explanation. Thank you

  2. Can you also add the screenshot of program execution on GNUSIM8085

    Please help me with this because I have to submit my lab file in college and I’m not able to run the program properly.


Leave a Comment

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

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need fund to operate the site, and almost all of it comes from our online advertising.

Please add to your ad blocking whitelist or disable your adblocking software.