8085 program to find the sum of series of even numbers

Problem – Calculate the sum of series of even numbers from the given list of numbers. The length of the list is in memory location 2200H and the series begins from memory location 2201H. Result will store at memory location 2210H.

Examples –

Input : 
2200H= 4H
2201H= 20H
2202H= l5H
2203H= l3H
2204H= 22H

Output : 
Result 2210H = 42H

Program –



MNEMONICS OPERANDS COMMENTS
LDA 2200H [A] <- 2200H
MOV C, A Initialize counter
MVI B, 00H sum = 0
LXI H, 2201H Initialize pointer
BACK: MOV A, M Get the number
ANI 0lH Mask Bit l to Bit7
JNZ SKIP Don’t add if number is ODD
MOV A, B Get the sum
ADD M SUM = SUM + data
MOV B, A Store result in B register
SKIP: INX H increment pointer
DCR C Decrement counter
JNZ BACK if counter 0 repeat
STA 2210H store sum
HLT Terminate program execution

Explanation –
A microprocessor is a computer processor that incorporates the functions of a central processing unit on a single integrated circuit.

  1. A is an 8-bit accumulator which is used to load and store the data directly.
  2. LDA is used to load accumulator direct using 16-bit address (3 Byte instruction).
  3. Instructions like MOV, MVI, LDA are the data transfer instructions.
  4. ADD is used to add data.
  5. HLT is used to halt the program.


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.