943,739 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 3980
  • Assembly RSS
Feb 1st, 2007
0

please help me check code Tasm fibonacci

Expand Post »
im converting a fibonacci c code to tasm assembly... i've started my code but im having a difficulty in the part where
return fibo(n-1)+fibo(n-2)...please help

the red fonts is where im not sure if my code is correct...can you please help

c code:
int fib(int n)
    {
    if (n <= 2) return 1
    else return fib(n-1) + fib(n-2)
    }

Tasm assembly code:

fibo proc near
    push bp
    mov bp, sp

    push ax
    push bx
    push cx

    mov ax, [bp+6]
    cmp ax,2
    jle one

    sub sp,2
    mov ax, [bp+6]

    push ax
    mov ax, [bp+4]
    push ax
    call fibo
        pop ax
        mov cx, [bp+6]
        add ax
        mov [bp+8], ax
        jmp done 
one:
    mov [bp+8],1
done:
    pop cx
    pop bx
    pop ax
    pop bp
        ret 4
fiboendp
Similar Threads
Reputation Points: 16
Solved Threads: 0
Light Poster
vbcielle is offline Offline
26 posts
since Sep 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Need anyone to tell me how to read this properly
Next Thread in Assembly Forum Timeline: 8 Queens Problem!?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC