Here we will see how to AND two nibbles of an 8-bit number.
Write 8085 Assembly language program to perform AND operation of two nibbles of an 8-bit number. Number is stored at F050, we will store result at F051.
To get the nibbles, we have to mask at first. So we need to mask the lower nibble and upper nibble and store them into different registers. The upper nibble will be shifted to the right four bits to make it lower nibble. Then we can perform the AND operation, and store it to the memory location F051.
|F000||3A, 50 F0|| ||LDA F050||memory element of F050|
|F003||47|| ||MOV B, A||Load A into B|
|F004||E6, 0F|| ||ANI 0F||Mask upper nibble|
|F006||4F|| ||MOV C, A||Load C with A|
|F007||78|| ||MOV A, B||Load A with B|
|F008||E6, F0|| ||ANI F0||Mask lower nibble|
|F00A||07|| ||RLC||Rotate A to the left|
|F00B||07|| ||RLC||Rotate A to the left|
|F00C||07|| ||RLC||Rotate A to the left|
|F00D||07|| ||RLC||Rotate A to the left|
|F00E||A1|| ||ANA C||AND Acc and C|
|F00F||32, 51, F0|| ||STA F051||Store result at F051|
|F012||76|| ||HLT||Terminate the program|