Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Оголошення змінних
- section .bss
- a resq 8
- i resq 8
- s resq 8
- section .text
- global _FBG
- ; Основний код
- _FBG:
- push ebp
- mov ebp, esp
- finit
- fld qword[ebp+8]
- fstp qword[a]
- ffree
- fld qword[a]
- mov ebx, 1 ; ebx = i = 1
- A:
- ; i = ebx++
- mov dword[i], ebx
- fld1 ; Загружаємо у стек 1
- fidiv dword[i] ; Ділимо 1 на і. 1/i
- fadd qword[s] ; s += 1/i
- fst qword[s] ; s = st0
- fcomip ; Порівнюємо st0[a] і st1[s]
- ja L ; Виходимо, якщо s > a
- inc ebx ; ++i
- jmp A ; Цикл...
- L:
- fld qword[s]
- sub esp,8
- fstp qword[esp]
- pop ebp
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement