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

[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:

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

Values of registers:

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

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