- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# 8085 program to find the sum of a series

In this program we will see how to add a blocks of data using 8085 microprocessor.

### Problem Statement

Write 8085 Assembly language program to add N 1-byte numbers. The value of N is provided.

### Discussion

In this problem we are using location 8000H to hold the length of the block. The main block is stored from address 8010H. We are storing the result at location 9000H and 9001H. The 9000H holding the lower byte, and 9001H is holding the upper byte.

Repeatedly we are taking the number from the memory, then adding it with accumulator and increase the register E content when carry flag is set. Initially E is cleared.

### Input

Address | Data |
---|---|

. . . | . . . |

8000 | 08 |

. . . | . . . |

8010 | AF |

8011 | 2E |

8012 | 7C |

8013 | 81 |

8014 | 2C |

8015 | BF |

8016 | FB |

8017 | 1C |

. . . | . . . |

### Flow Diagram

### Program

Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|

F000 | 21, 00, 80 | LXI H,8000H | Load the address to get count of numbers | |

F003 | 4E | MOV C, M | Load C with the count value | |

F004 | 21, 10, 80 | LXI H, 8010H | Load HL with the starting address | |

F007 | AF | XRA A | Clear accumulator | |

F008 | 5F | MOV E, A | Clear the E register also | |

F009 | 86 | LOOP | ADD M | Add Memory content with Accumulator |

F00A | D2, 0C, F0 | JNC SKIP | When Carry flag is 0, skip next task | |

F00D | 1C | INR E | Increase E, when C flag is set | |

F00E | 0D | SKIP | DCR C | Decrease C register by 1 |

F00F | 23 | INX H | Point to next location | |

F010 | C2, 09, F0 | JNZ LOOP | When Zero is false, go to LOOP | |

F013 | 21, 00, 90 | LXI H,9000H | Load address to store result | |

F016 | 77 | MOV M, A | Save accumulator content | |

F017 | 23 | INX H | Increase HL pair | |

F018 | 73 | MOV M, E | Store carry | |

F019 | 76 | HLT | Terminate the program |

### Output

Address | Data |
---|---|

. . . | . . . |

9000 | DC |

9001 | 03 |

. . . | . . . |

- Related Questions & Answers
- 8085 program to find the sum of series of even numbers
- Python program to find the sum of sine series
- C program to find the sum of arithmetic progression series
- 8085 program to find the sum of first n natural numbers
- Program to find sum of harmonic series in C++
- 8085 program to find sum of digits of 8 bit number
- 8085 program to find the factorial of a number
- 8086 program to find sum of Even numbers in a given series
- 8086 program to find sum of odd numbers in a given series
- C# Program to find the sum of a sequence
- 8085 program to find the set bit of accumulator
- Java Program to Find Even Sum of Fibonacci Series till number N
- 8085 program to find square root of a number
- 8085 program to find nth power of a number
- 8085 Program to find the smallest number

Advertisements