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.
Input : 2200H= 4H 2201H= 20H 2202H= l5H 2203H= l3H 2204H= 22H Output : Result 2210H = 42H
|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|
|JNZ||BACK||if counter 0 repeat|
|HLT||Terminate program execution|
A microprocessor is a computer processor that incorporates the functions of a central processing unit on a single integrated circuit.
- A is an 8-bit accumulator which is used to load and store the data directly.
- LDA is used to load accumulator direct using 16-bit address (3 Byte instruction).
- Instructions like MOV, MVI, LDA are the data transfer instructions.
- ADD is used to add data.
- HLT is used to halt the program.
- 8085 program to count total even numbers in series of 10 numbers
- 8085 program to count total odd numbers in series of 10 numbers
- 8085 program to find the sum of a series
- 8085 program to find larger of two 8 bit numbers
- 8085 program to find maximum of two 8 bit numbers
- 8085 program to find the sum of first n natural numbers
- 8085 program to find maximum and minimum of 10 numbers
- 8085 program to find smallest number between two numbers
- 8085 program to generate Fibonacci series
- 8086 program to find sum of Even numbers in a given series
- 8086 program to find sum of odd numbers in a given series
- 8085 program to add two 8 bit numbers
- 8085 program to add two 16 bit numbers
- 8085 program to add 2-BCD numbers
- 8085 program to divide two 8 bit numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.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.