Problem – Write an assembly language program in 8085 microprocessor to find 2’s complement of the contents of Flag Register.
- Initialize the value of Stack Pointer (SP) to 3999
- Push the contents of PSW (Register pair formed by Accumulator and Flag Register) into the memory stack
- Pop the contents from the stack into register pair BC
- Move the contents of register C to A
- Take 1’s complement of the contents of A
- Increment the contents of A by 1
- Move the contents of A to C
- Push the contents of register pair BC into the stack
- Pop the contents of stack into PSW
|2000||LXI SP 3999||SP <- 3999|
|2003||PUSH PSW||PUSH value of Accumulator and Flag into the stack|
|2004||POP B||POP value from Top of stack into register pair BC||2005||MOV A, C||A <- C||2006||CMA||A = 1’S complement of A||2007||INR A||A = A + 1||2008||MOV C, A||C <- A||2009||PUSH B||PUSH value of register pair BC into stack||200A||POP PSW||POP value from Top of stack into Accumulator and Flag||200B||HLT||Stop|
- LXI SP 3999 is used to initialize the value of Stack Pointer(SP) to 3999.
- PUSH PSW is used to push the contents of PSW into the memory stack.
- POP B is used to pop the contents from the top of stack into register pair BC.
- MOV A, C moves the contents of register C to A.
- CMA takes 1’s complement of the contents of A.
- INR A increments the contents of A by 1.
- MOV C, A moves the contents of A to C.
- PUSH B is used to push the contents of register pair BC into the stack.
- POP PSW is used to pop the contents of stack into PSW.
- HLT is used to end the program.
- 8085 program to access and exchange the content of Flag register with register B
- 8085 program to count the number of ones in contents of register B
- Flag register in 8085 microprocessor
- 8085 program to find 1's and 2's complement of 8-bit number
- 8085 program to find 1’s and 2’s complement of 16-bit number
- 8085 program to exchange content of HL register pair with DE register pair
- Flag register of 8086 microprocessor
- Register content and Flag status after Instructions
- Interface 8255 with 8085 microprocessor for 1’s and 2’s complement of a number
- 8085 program to find the sum of a series
- 8085 program to find the set bit of accumulator
- 8085 program to find the sum of series of even numbers
- 8085 program to find the sum of first n natural numbers
- 8085 program to find square of a 8 bit number
- 8085 program to find larger of two 8 bit numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.