Calculate sum of series of even numbers

; MEANS ADD ONLY EVEN NUMBERS IN AN ARRAY
;
;
;


MVI C, 05H ; SIZE OF ARRAY
LXI H, 2000H ; START ARRAY
MVI B, 00H ; SUM =0
BACK MOV A, M ;
ANI 01H ; MASK BITS D1 TO D7 LEAVING D0 ALONE
JNZ SKIP ;
ADD M ; ADD EVEN NUMBER
MOV B,A ;
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