Ah, cool! Then, here's an updated fibonacci function which handles fib(0) as well:
Just change the initial eax to something else to see different results. :)
(Oh, and you can't change the add to an inc. ecx is updated with a new value in each loop.)
mov eax, 1 ; In: eax = n ; Out: ecx = fib(n) mov ecx, 1 cmp eax, 0 jle end mov ebx, 0 loop: mov edx, ebx add edx, ecx mov ebx, ecx mov ecx, edx dec eax cmp eax, 0 jg loop end: invoke print, ecx
Just change the initial eax to something else to see different results. :)
(Oh, and you can't change the add to an inc. ecx is updated with a new value in each loop.)