global compute section .text ; ; calculating functions (sine, cosine, tangent, catangent) ; [ebp+8] is integer angle ; [ebp+12] is pointer to sine buffer ; [ebp+16] is pointer to cosine buffer ; [ebp+20] is pointer to tangent buffer ; [ebp+24] is pointer to catangent buffer ; compute: push ebp mov ebp, esp sub esp, 4 mov dword [ebp-4], 180 finit fild dword [ebp+8] fldpi fmulp fild dword [ebp-4] fdivp fld st0 ; copy radian angle fsin mov eax, [ebp+12] fstp dword [eax] ; extract sin fld st0 fcos mov eax, [ebp+16] fstp dword [eax] ; extract cos mov eax, [ebp+20] ; check tang cmp dword [eax], 0ffffffffh ; undefined value je .skip fptan fxch fst dword [eax] ; extract tang .skip: mov eax, [ebp+24] cmp dword [eax], 0ffffffffh je .quit fdivp ; ctng fstp dword [eax] ; extract ctng .quit: mov esp, ebp pop ebp ret