Get the best out of our app
GeeksforGeeks App
Open App
Browser
Continue

# 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 –

MNEMONICSOPERANDSCOMMENTS
LDA2200H[A] <- 2200H
MOVC, AInitialize counter
MVIB, 00Hsum = 0
LXIH, 2201HInitialize pointer
BACK:MOV A, MGet the number
ANI0lHMask Bit l to Bit7
JNZSKIPDon’t add if number is ODD
MOVA, BGet the sum
ADDMSUM = SUM + data
MOVB, AStore result in B register
SKIP:INX Hincrement pointer
DCRCDecrement counter
JNZBACKif counter 0 repeat
MOVA, BStore result in A register
STA2210Hstore sum
HLTTerminate 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