8085 program to find 2's complement of the contents of Flag Register Last Updated : 03 Oct, 2018 Comments Improve Suggest changes Like Article Like Report Problem – Write an assembly language program in 8085 microprocessor to find 2's complement of the contents of Flag Register. Example - Algorithm – 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 Stop Program – MEMORY ADDRESS MNEMONICS COMMENT 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 Explanation – 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. Comment More infoAdvertise with us Next Article 8085 program to count the number of ones in contents of register B H harshit-chhabra Follow Improve Article Tags : Computer Organization & Architecture system-programming microprocessor complement Similar Reads 8085 program to count the number of ones in contents of register B Problem: Write an assembly language program to count the number of ones in the contents of register B and store the result at memory location 3050. Example: Algorithm: Convert the decimal number in Accumulator to its binary equivalent.Rotate the digits of the binary number right without carry.Apply 4 min read 8085 program to access and exchange the content of Flag register with register B Problem - Write an assembly language program in 8085 microprocessor to access Flag register and exchange the content of flag register F with register B. Example - Assumptions - Initial values of flag register, register B and stack pointer are is 00, 3F, and 3FFF respectively. PSW stands for PROGRAM 3 min read 8085 program to find 1's and 2's complement of 8-bit number Problem - Write a program to find 1's and 2's complement of 8-bit number where starting address is 2000 and the number is stored at 3000 memory address and store result into 3001 and 3002 memory address. Example - Algorithm - Load the data from memory 3000 into A (accumulator)Complement content of a 2 min read 8085 program to find 1âs and 2âs complement of 16-bit number Prerequisite - 8085 program to find 1âs and 2âs complement of 8-bit number Problem - â Write a program to find 1âs and 2âs complement of 16-bit number where starting address is 2000 and the number is stored at 3000 memory address and store result into 3002 and 3004 memory address. Example - Algorith 2 min read 8085 program to find the set bit of accumulator Problem - All bits of an accumulator are 0 except a single bit which is 1. Write an assembly language program using 8085 to determine which bit of the accumulator is 1. The result should be a decimal number from 1 to 8 and is required to be stored in register C. Examples - Example 1 : Accumulator Co 4 min read 8085 programs to find 2's complement with carry | Set 2 Problem-1: Find 2's complement of an 8 bit number stored at address 2050. Result is stored at address 3050 and 3051. Starting address of program is taken as 2000. Example - Algorithm - We are taking complement of the number using CMA instruction.Then adding 01 to the result.The carry generated while 3 min read Like