Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

large fibonacci sequence using recursion [TASM]

assembly language [tasm]

This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic

#1 kuraisan


    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 25 May 2015 - 12:58 PM

iv to deliver a working Fibonacci sequence code using recursion to as an assignment , ive a code but i don't understand its functions and ive to describe its sequence and trace the code for my assignment , i need help if anyone can explain the code or even get me a new code with an explanation as i suck in assembly



        NUM_1  DB ?
        NUM_2  DB ?
        NUM_3  DB ?
        V1     DB ?
        V2     DB  ?
        NL     DB  '  ', 0DH,0AH,'$'
       MAIN PROC
                MOV AX,@DATA
                MOV DX,AX
                MOV CX,10
                MOV CH,0
                MOV NUM_1,0
                MOV NUM_2,1
                MOV DL,NUM_1
                OR  DL,30H
                MOV AH,02H
                INT  21H
                MOV DL,NUM_2
                OR DL,30H
                MOV AH,02H
                INT 21H
                        MOV AL,NUM_1
                        ADD AL,NUM_2
                        MOV AH,0
                        MOV BL,AL
                        MOV DL,10
                        DIV DL
                        ADD AX,3030H
                        MOV V1,AL
                        MOV V2,AH
                        MOV DL,V1
                        MOV AH,02H
                        INT 21H
                        MOV DL,V2
                        MOV AH,02H
                        INT 21H
                        MOV AL,NUM_2
                        MOV NUM_1,AL
                        MOV NUM_2,BL
                        LOOP L1
                MOV AX,4C00H
                INT 21H
        MAIN ENDP
       END MAIN
;               OUTPUT

;0 1 01 02 03 05 08 13 21 34 55 89  

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download