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.

Input:

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.

Instruction:

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

HLT

Programming Details
Memory Location OPCODE Operand Label Hex Code
2002 LDA 2000H 3AH
2003 00H
2004 20H
2005 CMA 2FH
2006 INR A 3CH
2007 STA 2001H 32H
2008 01H
2009 20H
200A HLT 76H