Monday, April 4, 2011

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 ;

No comments:

Post a Comment