Program to mask the lower nibble of an 8-bit number

Q. Write an 8085 program and draw a flowchart to mask the lower nibble of an 8-bit number.(8085 Microprocessor Program)

Flowchart/Algorithm

Program

Address Mnemonics Operand Opcode Comments
2000 LDA 3000H 3A Load H-L pair with data from 3000H.
2001 00
2002 30
2003 ANI F0H E6 AND Immediate F0H with reg. A.
2004 F0 Immediate value F0H.
2005 STA 3001H 32 Store the result at memory location 3001H.
2006 01
2007 30
2008 HLT 76 Halt

Output

Before Execution:

3000H: 45H 

After Execution:

3001H: 40H

Program Explanation

  1. This program masks the lower nibble of an 8-bit number stored in memory location 3000H.
  2. Let us assume that the operand stored at memory location 3000H is 45H.
  3. The operand is moved to accumulator from memory location 3000H.
  4. Then, AND operation of F0H is performed with the accumulator. This results in the masking of the lower nibble.
  5. The result is stored at memory location 3001H.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.