Program to find number of negative numbers in array

I am personally not able to understand this particular program as it uses MSB instead of sign flag. This is direct rip off untested version from a book.
——————–
        MVI C, 05H ; SIZE OF ARRAY
MVI B, 00H ; COUNT OF NEGATIVE NUMBERS
LXI H, 2000H ; LOAD STARTING ADDRESS
BACK MOV A, M ;
ANI 80H ;
JZ SKIP ; CHECK IF MSB = 1 IF MSB = 1 THEN NUMBER IS NEGATIVE
INR B ;
SKIP INX H ;
DCR C ;
JNZ BACK ;
STA 1FFFH ;
HLT ;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s