Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern printf
- extern fflush
- extern scanf
- section .data
- fmt db "%d", 0
- fmtPrint db "%d", 10, 0
- num0 dd 0
- num1 dd 1
- section .bss
- num resd 1
- temp resd 1
- section .text
- global main
- main:
- push num
- push fmt
- call scanf
- add esp, 8
- mov dword[temp], 0
- mov dword[temp + 4], 1
- mov esi, 2
- looping:
- mov ecx, esi
- dec ecx
- mov eax, [temp + 4*ecx]
- dec ecx
- add eax, [temp + 4*ecx]
- mov dword[temp + 4*esi], eax
- inc esi
- cmp esi, [num]
- jbe looping
- mov edi, [num]
- mov eax, [temp + 4*edi]
- ; printf
- push eax
- push fmtPrint
- call printf
- add esp, 8
- exit:
- push 0
- call fflush
- mov eax, 1
- mov ebx, 0
- int 0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement