Program to genereate Fibonacci Sequence

Posted by Psycho Programer On Saturday, December 18, 2010 18 comments

MVI A, 00H
STA 8000H
MVI A, 01H
STA 8001H
MVI B, 08H
LXI H, 8000H
BACK:
MOV A, M
INX H
ADD M
INX H
MOV M, A
DCR B
DCX H
JNZ BACK
HLT

18 comments:

Unknown said...

thnx. bro......

SK MUKLESUR RAHAMAN said...

Thanks bro....

SK MUKLESUR RAHAMAN said...

Thanks bro....

Unknown said...

baba thanks..

Unknown said...

I guess DCR B would come after DCX H

Unknown said...

This version of the program uses the DAA instruction which gives you binary coded decimals instead of the hex-values.

LXI H,2050
MVI M,01 // stores 1 since fibonacci series starts at 1
MVI E,09 //counter i.e.. it runs 9 times after the initial 1 & 1
INX H
MVI M,01
MOV A,M

KK: DCX H
ADD M
DAA
INX H
INX H
MOV M,A
DCR E
JNZ KK
HLT

Unknown said...
This comment has been removed by the author.
Unknown said...

There is an error in the logic. If you give 08 as number of terms it will actually print 10 terms. The first 2 terms are not counted.

Unknown said...

not running at all...

Anonymous said...

Wrong Program....
Close your site.....
>_<

Unknown said...

program to generate fibo sequence for 10 no.

#source code

lxi H,300h
mvi a,00h
mov m,a
mvi b,01h
inx H
mov m,b
mvi c,10h
L: add b --L is used as label
inx H
mov m,a
mov a,b
mov b,m
dcr c
jnz L
hlt

the value will be stored fro mem. loc. 3000h onwards.

Mohnish Sachdeva said...

check this out
easy to understand and run

LXI H 8061h
MOV D M
MVI C 01h

L1: ADD B
MOV B C
MOV C A
INX H
MOV M A
DCR D
JNZ L1
HLT

Ayushi said...

It wouldn't matter because DCX does not affect any flags.

How Indexing Works in Mysql said...

Great bro

Unknown said...

write a program to generate the fibonacci sequence number generate 14 numbers of sequence and stored if in memory
8085 processor?
Fast

Unknown said...

i need a 8085 program that can calculate the LCM of more than 2 numbers...
can any one help me...

videlicet said...

DCR B should come after DCX H. Also DCX does not set or reset zero flag.

sabrenavaca said...

Las Vegas - Casino in NV at Mapyro
Search for the best 원주 출장샵 casinos in Las Vegas, NV. 상주 출장샵 전라북도 출장안마 We have 광양 출장샵 a map for casinos, hotels, restaurants and hotels in 안동 출장샵 Las Vegas.

Post a Comment