In this program, we are going to write an 8085 Program To Mask Upper Nibble in the 8085 microprocessor with a program flow chart and explanation of the program.
8085 Program To Mask Upper Nibble
Program Statement
Write an assembly language program to mask the upper nibble of an 8-bit number. Assume that the 8-bit number is stored in the accumulator. Store the result in register B.
Explanation of Program
- We have to mask the upper nibble i.e. we have to separate the upper nibble and in the result, only the lower nibble should be present.
e.g. : A = 67 H A : 0 1 1 0 0 1 1 1 0FH : 0 0 0 0 1 1 1 1 (Logically AND with 0FH) ---------------------------- A : 0 0 0 0 0 1 1 1 (Result)
Assembly Language Program
Instruction | Comment | Operation |
---|---|---|
ANI 0F H | Logically AND 0FH with the contents of the accumulator. | A = 07 H |
MOV B, A | Store the result in register B | B = 07 H |
HLT | Terminate program execution | Stop |