study_public/asm2/example_c_asm_and_coproc/sum.asm
2020-12-02 15:18:15 +03:00

20 lines
276 B
NASM

; 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