blob: 339742a42683be690b04d54c082d22685ca3bc66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
|