-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.asm
83 lines (76 loc) · 962 Bytes
/
functions.asm
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
section .rodata
f1_k: dt 0.6
f1_b: dt 3.0
f2_c: dt 2.0
f2d_k: dt 3.0
f3_k: dt 3.0
section .text
; x: ld (ebp+8)
; -> ld
; 0.6x + 3
global f1
f1:
enter 8,0
fld tword [ebp+8]
fld tword [f1_k]
fmulp
fld tword [f1_b]
faddp
leave
ret
; 0.6
global f1d
f1d:
enter 8,0
fld tword [f1_k]
leave
ret
; (x-2)^3 - 1
global f2
f2:
enter 8,0
fld tword [ebp+8]
fld tword [f2_c]
fsubp
fld st0
fld st0
fmulp
fmulp
fld1
fsubp
leave
ret
; 3*(x-2)^2
global f2d
f2d:
enter 8,0
fld tword [ebp+8]
fld tword [f2_c]
fsubp
fld st0
fmulp
fld tword [f2d_k]
fmulp
leave
ret
; 3/x
global f3
f3:
enter 8,0
fld tword [f3_k]
fld tword [ebp+8]
fdivp
leave
ret
; -3/x^2
global f3d
f3d:
enter 8,0
fld tword [f3_k]
fld tword [ebp+8]
fdivp
fld tword [ebp+8]
fdivp
fchs
leave
ret