- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 generate Fibonacci sequence
In this program we will see how to generate Fibonacci sequence.
Problem Statement
Write 8085 Assembly language program to generate the first ten elements of the Fibonacci sequence using registers only and store them in memory locations 8050H to 8059H.
Discussion
This program will generate the Fibonacci numbers. The Fibonacci numbers follows this relation F(i) = F(i - 1) + F(i - 2) for all i >2 with F(1) = 0, F(2) = 1.
Input
In this case we are not providing any input, this program will generate ten Fibonacci numbers.
Flow Diagram
Program
Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|
8000 | 21, 50, 80 | START | LXI H 8050H | Pointer to the OUT-BUFFER |
8003 | AF | XRA A | Clear accumulator and reg. B | |
8004 | 47 | MOV B, A | ||
8005 | 77 | MOV M, A | Copying content to the target location | |
8006 | 3C | INR A | Increment A | |
8007 | 23 | INX H | Go to the next dest. address. | |
8008 | 77 | MOV M, A | Moving the content | |
80 09 | 0E, 08 | MVI C, 08H | Initialize counter | |
800B | 80 | LOOP | ADD B | Getting the next term |
800C | 46 | MOV B, M | Initializing term e.g. F1 = F2 | |
800D | 23 | INX H | Go to the next dest. address. | |
800E | 77 | MOV M, A | Writing to the OUT-BUFFER | |
800F | 0D | DCR C | Decrement count until 0 is reached F3= F1 + F2 (A) = (A) + (B) This is done with instruction ADDB. | |
8010 | C2, 0B, 80 | JNZ LOOP | ||
8013 | 76 | HLT | Terminate the program |
Output
Address | Data |
---|---|
... | ... |
8050 | 00 |
8051 | 01 |
8052 | 01 |
8053 | 02 |
8054 | 03 |
8055 | 05 |
8056 | 08 |
8057 | 0D |
8058 | 15 |
8059 | 22 |
... | ... |
- Related Articles
- 8086 program to generate Fibonacci Sequence
- Python Program to Display Fibonacci Sequence Using Recursion
- Generate Fibonacci Series
- The Fibonacci sequence in Javascript
- Fibonacci like sequence in JavaScript
- How to print the Fibonacci Sequence using Python?
- C++ Program to Generate Randomized Sequence of Given Range of Numbers
- C++ Program to Generate a Graph for a Given Fixed Degree Sequence
- Finding Fibonacci sequence in an array using JavaScript
- C++ Program to Search Sorted Sequence Using Divide and Conquer with the Aid of Fibonacci Numbers
- C++ Program to Generate a Sequence of N Characters for a Given Specific Case
- Generate an integer sequence in MySQL?
- C++ Program to Display Fibonacci Series
- Java Program to Display Fibonacci Series
- Swift Program to Display Fibonacci Series

Advertisements