Prerequisite – Binary to/from Gray Code
Problem – Write an assembly language program in 8085 microprocessor to convert binary numbers to gray.
- Set the Carry Flag (CY) to 0.
- Load the data from address 2050 in A.
- Move the data of A(accumulator) into register B.
- Rotate the bits of A to right.
- XOR the contents of register A and B.
- Store the result at memory address 3050.
|2000||STC||CY <- 1||2001||CMC||CY <- 1's Compliment of CY||2002||LDA 2050||A <- 2050||2005||MOV B,A||B <- A||2006||RAR||Rotate accumulator right with carry||2007||XRA B||A = A XOR B||2008||STA 3050||3050 <- A||200B||HLT||Stop|
- STC is used to set carry flag (CY) to 1.
- CMC is used to take 1’s compliment of the contents of carry flag (CY).
- LDA 2050 is used load the data from address 2050 in A.
- MOV B, A is used to move the data of A into B.
- RAR is used to rotate the bits of A along with carry flag (CY) to right one time.
- XRA B is used to perform XOR operation between the contents of register A and B.
- STA 3050 is used to store the contents of A to 3050.
- HLT is used end the program.
- 8085 program to convert gray to binary
- 8085 program to convert a BCD number to binary
- 8085 program to convert 8 bit BCD number into ASCII Code
- 8085 program to convert a hexadecimal number into ASCII code
- 8085 program to count total odd numbers in series of 10 numbers
- 8085 program to count total even numbers in series of 10 numbers
- 8085 program for Binary search
- 8085 program to add two 16 bit numbers
- 8085 program to add 2-BCD numbers
- 8085 program to add two 8 bit numbers
- 8085 code to convert binary number to ASCII code
- 8085 program to multiply two 16-bit numbers
- 8085 program to add numbers in an array
- 8085 program to sum of two 8 bit numbers without carry
- 8085 program to swap 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.