Write an 8085 program to find 2’s complement of a given 8-bit hexadecimal number
While doing binary operations we have come across binary addition, multiplication, division, subtraction, conversion and also 1’s and 2’s complement.
Well, in this program, we are going to learn how we can perform a 2’s complement operation of a given 8-bit number in 8085 simulator toolkit.
Now when it comes to addressing mode, for this program, we are going to specifically be using direct addressing mode.
Let the 8-bit hexadecimal number be 55H, which we will be storing at the 2000H memory location, and the end result will be stored at the 2001H memory location.
LDA 2000H// using LDA we copy the content of 2000H memory location into the accumulator
CMA // using CMA instruction we perform the 1’s complement operation
INR A// in order to perform 2’s complement we increment the content of accumulator by 1 by using INR
STA 2001H //finally we store the result in 2001H memory location
|Memory Location||OPCODE||Operand||Label||Hex Code|