-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnth-fibo.asm
More file actions
51 lines (39 loc) · 711 Bytes
/
nth-fibo.asm
File metadata and controls
51 lines (39 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
BITS 32
extern scanf
extern printf
section .data
format: db "%d",0
out: db "%d",10,0
section .text
global main
main:
push ebp
mov ebp,esp
sub esp,0x10
lea eax,[ebp-0x4]
push eax
push format
call scanf
mov DWORD [ebp-0x8], 0
mov eax, DWORD [ebp-0x4]
mov ebx,0
mov ecx,1
cmp eax,1
jnz nx
mov ecx,0
jmp endz
nx:
sub eax,2
looop:
add DWORD [ebp-0x8],1
mov edx,ecx
add ecx,ebx
mov ebx,edx
cmp DWORD [ebp-0x8],eax
jl looop
endz:
push ecx
push out
call printf
leave
ret