Counting of number of zeros,even and odd numbers in an array
AIM :To prepare an assembly language program for 8085 to count the number of zeros,even and odd numbers in an array
PROGRAM
MVI C,00
MVI D,00
MVI E,00
LXI H,4200
MOV B,M
INX H
LXI H,4200
MOV B,M
LABEL4:INX H
MOV A,M
CPI 00
JNZ LABEL1
INR C
JNZ LABEL2
LABEL1:RRC
JNZ LABEL3
INR D
JMP LABEL2
LABEL3:INR E
LABEL2:DCR B
JNZ LABEL4
INX H
MOV A,C
MOV M,A
INX H
MOV A,D
MOV M,A
INX H
MOV A,E
MOV M,A
HLT
SAMPLE OUTPUT
|
ADDRESS |
DATA |
INPUT/OUTPUT |
|
4200 |
09 |
Input |
|
4201 |
00 |
Input |
|
4202 |
06 |
Input |
|
4203 |
02 |
Input |
|
4204 |
11 |
Input |
|
4205 |
0A |
Input |
|
4206 |
0D |
Input |
|
4207 |
00 |
Input |
|
4208 |
0F |
Input |
|
4209 |
10 |
Input |
|
420A |
02 |
Output |
|
420B |
04 |
Output |
|
420C |
03 |
Output |
RESULT:A program to find the number of even numbers ,odd numbers and zeros ,for 8085 was prepared and output obtained.
You may also like:
Custom Search

Recent Comments