study_public/asm2/example_c_asm_and_coproc/sum.asm

20 lines
276 B
NASM
Raw Normal View History

2020-12-02 15:18:15 +03:00
; Copyright 2020 KoroLion (github.com/KoroLion)
global sum
section .data
section .bss
temp: resb 4
section .text
; sum(x, y)
sum:
finit
fld dword [esp + 4] ; = x
fadd dword [esp + 8] ; += y
fst dword [temp] ; [temp] = st0
mov eax, [temp]
ret