8085 program to reverse 8 bit number
Problem – Write an assembly language program in 8085 microprocessor to reverse 8 bit number.
Example –

Assume that number to be reversed is stored at memory location 2050, and reversed number is stored at memory location 3050.
Algorithm –
- Load content of memory location 2050 in accumulator A
- Use RLC instruction to shift content of A by 1 bit without carry. Use this instruction 4 times to reverse the content of A
- Store content of A in memory location 3050
Program –
| MEMORY ADDRESS | MNEMONICS | COMMENT |
|---|---|---|
| 2000 | LDA 2050 | A <- M[2050] |
| 2003 | RLC | Shift content of accumulator left by 1 bit without carry |
| 2004 | RLC | Shift content of accumulator left by 1 bit without carry |
| 2005 | RLC | Shift content of accumulator left by 1 bit without carry |
| 2006 | RLC | Shift content of accumulator left by 1 bit without carry |
| 2007 | STA 3050 | M[2050] <- A |
| 200A | HLT | END |
Explanation – Register A used:
- LDA 2050: load value of memory location 2050 in Accumulator A.
- RLC: shift content of accumulator left by 1 bit without carry.
- RLC: shift content of accumulator left by 1 bit without carry.
- RLC: shift content of accumulator left by 1 bit without carry.
- RLC: shift content of accumulator left by 1 bit without carry.
- STA 3050: store content of A in memory location 3050.
- HLT: stops executing the program and halts any further execution.
Recommended Posts:
- 8085 program to reverse 16 bit number
- 8085 program to check whether the given number is even or odd
- 8085 program to convert an 8 bit number into Grey number
- 8085 program to convert an 8 bit BCD number into hexadecimal number
- 8085 program to check whether the given 16 bit number is palindrome or not
- 8085 program to find 1's and 2's complement of 8-bit number
- 8085 program to find square of a 8 bit number
- 8085 program to determine if the number is prime or not
- 8085 program to find sum of digits of 8 bit number
- 8085 program to find nth power of a number
- 8085 program to find the factorial of a number
- 8085 program to count number of elements which are less than 0A
- 8085 program to convert a BCD number to binary
- 8085 program to find 1’s and 2’s complement of 16-bit number
- 8085 program to count number of once in the given 8-bit number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. 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.



