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