In the last program, we saw how we can separate a byte into two nibbles. In this program, we are going to learn how we can combine two nibbles to form a byte.

So, basically, this program is just the opposite of the last program. And this program, we are going to use immediate addressing mode.


Like the last program, we are going to need two memory locations; 2000H for storing the first nibble, and in the 2001H memory location, we will store the other nibble.

And in the 2002H memory location, we are going to store the result.


LXI H,2000H //using LXI instruction, we will use HL register as a pointer to point to the content of 2000H

MOV A,M //using MOV instruction we will copy the content of memory location to accumulator

RRC //using RRC instruction we will rotate the content i.e. 04H




ORI 05H //finally we will perform the OR operation with 05H

STA 2002 //now we will store the result at 2002H


Programming Details
Memory Location OPCODE Operand Label Hex Code
2003 LXI H, 2000 21H
2004 00H
2005 20H
2006 MOV A,M 7EH
2007 RRC 0FH
2008 RRC 0FH
2009 RRC 0FH
200A RRC 0FH
200B ORI 05 F6H
200C 05H
200D STA 2002 32H
200E 02H
200F 20H
2010 HLT 76H