You are currently viewing [PRACTICAL] Implement program to count no of negative values in given block of data
Microprocessor 8085 programming

[PRACTICAL] Implement program to count no of negative values in given block of data

5
(3)

[PRACTICAL] IMPLEMENT PROGRAM TO COUNT NO OF NEGATIVE VALUES IN GIVEN BLOCK OF DATA

Are you looking for a step-by-step guide to Implement program to count no of negative values in given block of data? here are the steps to implement program to count no of negative values in given block of data.

Theory:

This program used to find negative number from array of elements. Here we are taking array of 10 elements and check each number if it is negative than increment count. In this program register D is used to count negative values, we can check whether given number is negative or not using Sign flag (S) in flag register or using JM instruction. Starting location of array is C050h.

Program:

LXI H,C050H
MVI C,0AH
MVI B,00H
MVI D,00H
NEXT: MOV A,M
ORI 00H
JM MIN
INR B
JMP SKIP
MIN: INR D
SKIP: INX H
DCR C
JNZ NEXT
HLT     

Output:

Values of array elements:

Values of registers:

For more practical related to 885 Programming please visit theĀ 8085 Programming link

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 3

No votes so far! Be the first to rate this post.

As you found this post useful...

Share this post on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?