Experiment-3 Program to generate Fibonacci series 8086 8086 Programming by Ravinder Nath Rajotiya - April 19, 2019April 15, 20210 Share on Facebook Share Send email Mail Print Print Table of Contents Toggle AIM : Write a Program to generate Fibonacci seriesObjectives:System Requirement : Setting up the Trainer Kit:Logic / AlgorithmFlowchart to generate Fibonacci SeriesExplanation of the CodeExecutionExecuting The ProgramVerification of ResultViva QuestionQue-1: How do you generate the Fibonacci Series?Que-2: What is the use of CL and BL register in this programQue-3: What is the purpose of the MOV [DI], AL statement in the above program? AIM : Write a Program to generate Fibonacci series Objectives: After completing this experiment, students will be able to : understand the use of 8086 mnemonics and their opcode Draw Flowchart for the program Develop program to generate the Fibonacci series 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 Start Initialize the CL register to store the to numbers accumulator (Ax) to ‘0000, register BL to first no. and DI to starting destination address Save first number from BL to [DI} and Increment the DI. Add AL and number in BL Save the result at [DI] Move AL <- BL; and Move BL <- [DI] Increment DI Decrement CL Jump to step 4 if CL not equal to zero 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 Execution 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 Cmd_Wrd= 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 Share on Facebook Share Send email Mail Print Print