8085 program to separate (or split) a byte into two nibbles
Problem – Write an assembly language program in 8085 microprocessor to split a byte into two nibbles and store result in 2001H and 2002H.
Example –

Algorithm –
- Load the content of memory location 2500 in accumulator A.
- Now we will perform AND operation with the content of accumulator and OFH.
- Using STA we will now store the result in 2501H memory location.
- Using LDA we’ll load the content of 2500H in the accumulator.
- Once again perform AND operation to separate another nibble i.e AND operation with the content of accumulator and F0H.
- Now rotate each bit in accumulator right by one position and repeat this step four times.
- Now using STA we will store another nibble in 2502H memory location.
Program –
| MEMORY ADDRESS | MNEMONICS | COMMENT |
|---|---|---|
| 2000 | LDA 2500H | A <- M[2500] |
| 2003 | ANI 0FH | A <- A (AND) 0FH |
| 2005 | STA 2501H | M[2501] <- A |
| 2008 | LDA 2500H | A <- M[2500] |
| 200B | ANI F0H | A <- A (AND) F0H |
| 200D | RRC | Rotate right by one position |
| 200E | RRC | Rotate right by one position |
| 200F | RRC | Rotate right by one position |
| 2010 | RRC | Rotate right by one position |
| 2011 | STA 2502H | M[2502] <- A |
| 2014 | HLT | Stop the program. |
Explanation –
RRC – Each binary bit of the accumulator is rotated right by one position. Bit D0 is placed in the position of D7 as well as in the Carry flag. CY is modified according to bit D0.
- LDA 2500H – loads the content of memory location 2500 in accumulator A.
- ANI 0FH –Perform AND operation with contents of accumulator and 0FH.
- STA 2501H –store contents of Accumulator to memory location 2501H.
- LDA 2500H – loads the content of memory location 2500 in accumulator A.
- ANI F0H – Perform AND operation with contents of accumulator and F0H.
- RRC –rotate each bit in accumulator right by one position.
- RRC –rotate each bit in accumulator right by one position.
- RRC –rotate each bit in accumulator right by one position.
- RRC –rotate each bit in accumulator right by one position.
- STA 2502H –store contents of Accumulator to memory location 2502H.
- HLT –Stop the execution of program.
Recommended Posts:
- 8085 program to check whether both the nibbles of 8 bit number are equal or not
- 8085 program to perform AND operation in nibbles of 8 bit number
- 8085 program to show masking of lower and higher nibbles of 8 bit number
- 8085 program to separate odd and even nos from a given list of numbers
- 8085 program to add two 16 bit numbers
- 8085 program to add 2-BCD numbers
- 8085 program to add two 8 bit numbers
- 8085 program for bubble sort
- 8085 program to find the sum of a series
- 8085 program to reverse 8 bit number
- 8085 program to swap two 8-bit numbers
- 8085 program for hexadecimal counter
- 8085 program to reverse 16 bit number
- 8085 program to add numbers in an array
- 8085 program to sum of two 8 bit numbers without carry
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.

