From 21f616b5593d87d6381c1f3d67a3df0c442dba44 Mon Sep 17 00:00:00 2001 From: scratko Date: Wed, 27 Mar 2024 22:38:51 +0300 Subject: Initial commit --- compute_functions.asm | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 compute_functions.asm (limited to 'compute_functions.asm') diff --git a/compute_functions.asm b/compute_functions.asm new file mode 100644 index 0000000..339742a --- /dev/null +++ b/compute_functions.asm @@ -0,0 +1,44 @@ +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 -- cgit v1.2.3