# 8085 program to take all numbers whose D7 and D1 are 0

Here we will see how we can take all numbers whose D7 and D1 bits are 0, using 8085.

## Problem Statement

Write 8085 program to take all numbers from an array whose D7 and D1 bits are 0. Numbers are stored from 8001, and the array size is stored at 8000. Store the result from 9000 onwards.

## Discussion

To solve this problem, we will AND the number by 82H (1000 0010). If the result is 0, then the number is acceptable. If the bit position D7 and D1 are 0, then only the result will be 0.

Data

8000
0A
8001
E9
8002
D3
8003
61
8004
8005
2A
8006
1F
8007
5D
8008
A6
8009
A9
800A
35

## Program

HEX Codes
Labels
Mnemonics
F000
21, 00, 80

LXI H,8000
F003
4E

MOV C,M
Store size into C
F004
11, 00, 90

LXI D,9000
F007
23
LOOP
INX H
Point to next location
F008
7E

MOV A,M
Take number from memory to A
F009
E6, 82

ANI 82H
AND 82H with A
F00B
C2, 10, F0

JNZ SKIP
if A is not 0, then skip it
F00E
12

STAX D
Else store A into memory pointed by DE
F00F
13

INX D
point to next location
F010
0D
SKIP
DCR C
decrease counter by 1
F011
C2, 07, F0

JNZ LOOP
F014
76

HLT
Terminate the program

Data

9000
61
9001
54
9002
35