AIM : Write a Program to generate Fibonacci series


After completing this experiment, students will be able to :

  1. understand the use of 8086 mnemonics and their opcode
  2. Draw Flowchart for the program
  3. Develop program to generate the Fibonacci series
  4. analyse the program

System Requirement : 

  • 8086 Trainer Kit with Key Board

Setting up the Trainer Kit:

  • Ensure that standard IBM PC/AT system keyboard is connected
  • System is Powered ON
  • Student has a handy opcode table for programming

Logic / Algorithm

  1. Start
  2. Initialize the CL register to store the to numbers accumulator (Ax) to ‘0000, register BL to first no. and DI to starting destination address
  3. Save first number from BL to [DI} and Increment the DI.
  4. Add AL and number in BL
  5. Save the result at [DI]
  6. Move AL <- BL; and Move BL <- [DI]
  7. Increment DI
  8. Decrement CL
  9. Jump to step 4 if CL not equal to zero
  10. Stop

Flowchart to generate Fibonacci Series

Explanation of the Code

Program Address Op-Code Label Mnemonic Comment
1000:0200 F8 CLC ; Clear carry
1000:0201 BF    00    13 MOV DI, 1300h ; Initialize destination to store series
1000:0204 B1    05 MOV CL,05h ; Load CL with total no. desired in series
1000:0206 B8    00    00 MOV AX,00H ; Clear Accumulator
1000:0209 B3   01  MOV BL,01H ; Set the first number of Fibonacci Series
1000:020B 88    1D MOV [DI], BL ; Save the first number of series
1000:020D 47  INC DI ; increment destination pointer
1000:020E 02    C3  L1: ADD AL,BL ; Loop the this and next number
1000:0210 88    05  MOV [DI],AL ; save
1000:0212 8A    C3  MOV AL,BL ; load next as first
1000:0214 8A    1D  MOV BL,[DI] ; load BL with just saved no. in series
1000:0216 47  INC DI ; increment counter
1000:0217 FE    C9  DEC CL ; Decrement count
1000:0219 75   F3  JNZ L1 ; Check if count is zero. Repeat if not zero
1000:021B F4 HLT ; Stop



Executing The Program

Key Pressed/Action Display on LCD
Press G  from Keyboard BURST or Single Step
Press Enter Segm_Adr
1000 Press Enter Ofst
0200 Press Enter Wait



Do not press the Reset Key; Check the result by using Sub_Mir Command

Verification of Result

DATA Register Value
Total number desired in Series                   CL
Starting number of Series BL


Result Destination Address Value


Viva Question

Que-1: How do you generate the Fibonacci Series?

Ans: Let the Beginning number be 1. System adds 0 and 1, save the result as first number at destination

Keep first number and add with just save result and repeat the above steps

Que-2: What is the use of CL  and BL register in this program

Ans: CL stores the total number desired in the series and BL stores the first number of the series.

Que-3: What is the purpose of the MOV [DI], AL  statement in the above program?

Ans: The instruction MOV [DI], Al stores the value of AL at the address given in DI

Updated: April 27, 2019 — 1:54 pm

Leave a Reply

Your email address will not be published. Required fields are marked *

care4you © 2020 Connect On Facebook DMCA.com Protection Status