This code represents an example of finding Fibonacci number and sum of Fibonacci series up to n-th number. It is written in assembly language and simulated using emu8086 emulator. Though it is a general program, it cannot find more than 8-bit binary number, the reason is 8086 processor registers are 8-bit.
This is a general program for finding any number in Fibonacci series up to its limit and finding summation of two Fibonacci numbers written in assembly code and I checked this code with emu8086 emulator. Here it goes:
Code:
; this program calculates the n-th Fibonacci number
; and the sum of the fibonacci series upto n-th number
;the n-th number must be given in CX register
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 100H
;S=F1+F2 // these 3 lines are algorithom
;F1=F2;
;F2=S;
XOR AX,AX ; clearing garbage value if any
XOR BX,BX
This is a general program for finding any number in Fibonacci series up to its limit and finding summation of two Fibonacci numbers written in assembly code and I checked this code with emu8086 emulator. Here it goes:
Code:
; this program calculates the n-th Fibonacci number
; and the sum of the fibonacci series upto n-th number
;the n-th number must be given in CX register
CODE SEGMENT
ASSUME CS:CODE,DS:CODE
ORG 100H
;S=F1+F2 // these 3 lines are algorithom
;F1=F2;
;F2=S;
XOR AX,AX ; clearing garbage value if any
XOR BX,BX