Q. Write an 8085 program and draw a flow chart to find 2’s complement of an 8-bit number.(8085 Microprocessor Program)
|2000||LDA||3000H||3A||Load H-L pair with data from 3000H.|
|2005||STA||3001H||32||Store the result at memory location 3001H.|
- This program finds the 2’s complement of an 8-bit number stored in memory location 3000H.
- Let us assume that the operand stored at memory location 3000H is 85H.
- The operand is moved to accumulator from memory location 3000H.
- Then, its complement is found by using CMA instruction.
- One is added to accumulator by incrementing it to find its 2’s complement.
- The result is stored at memory location 3001H.
2 thoughts on “Program to find 2’s complement of an 8-bit number”
Why can’t we use NEG instead of CMA
How we store 85 in 3000H?,then only we can find the correct result, right? . Pls give me an explanation. Thank you