Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ; |
2 | ; include file for Crown_s Soft Screensaver |
||
3 | ; |
||
4 | ; You may add you own figures for Screensaver. |
||
5 | ; For example see tor function. |
||
6 | ; If you add new figures, please contact us, we will help you. |
||
7 | ; |
||
8 | ;input parametrs: |
||
9 | ; alf=word [esi] - random quantity 0<=alf<=0xffff |
||
10 | ; bet=word [esi+2] - random quantity 0<=bet<=0xffff |
||
11 | ; Fl - number of point in frame |
||
12 | ; (may be used as random quantity) 0<=Fl<=mFl |
||
13 | ; p - number of frame |
||
14 | ; (may be use for animated figures) |
||
15 | ; |
||
16 | ;output parametrs: |
||
17 | ; st0=x, st1=y, st2=z |
||
18 | |||
19 | |||
20 | |||
21 | align 8 |
||
22 | |||
23 | const_mpi dd 0.0000958767251683032697061874258638112 ; 1/00007fffh*pi |
||
24 | const_m dd 0.0000305185094759971922971282082583087 ; 1/00007fffh |
||
25 | |||
26 | |||
27 | |||
28 | tabl_calls dd cubes |
||
29 | dd explosion |
||
30 | dd galaxy |
||
31 | dd cube |
||
32 | dd sin |
||
33 | dd tor1 |
||
34 | dd tors |
||
35 | dd spiral |
||
36 | dd tor |
||
37 | dd planet |
||
38 | dd balls |
||
39 | num_tabl_calls=11 |
||
40 | |||
41 | tor_r dw 60 |
||
42 | tor_R dw 175 |
||
43 | |||
44 | balls_x1 dw 0 |
||
45 | balls_x2 dw 189 |
||
46 | balls_x3 dw -94 |
||
47 | balls_x4 dw -94 |
||
48 | balls_y1 dw 0 |
||
49 | balls_y2 dw 0 |
||
50 | balls_y3 dw 163 |
||
51 | balls_y4 dw -163 |
||
52 | balls_z1 dw 200 |
||
53 | balls_z2 dw -71 |
||
54 | balls_z3 dw -71 |
||
55 | balls_z4 dw -71 |
||
56 | balls_R dw 35 |
||
57 | |||
58 | cube_R dw 118 |
||
59 | |||
60 | spiral_R dw 100 |
||
61 | spiral_r dw 20 |
||
62 | spiral_h dw 150 |
||
63 | spiral_L dw 12 |
||
64 | |||
65 | sin_a dw 165 |
||
66 | sin_c dw 3 |
||
67 | sin_k dw 20 |
||
68 | sin_A dw 85 |
||
69 | sin_R dw 10 |
||
70 | |||
71 | planet_R dw 120 |
||
72 | planet_r dw 25 |
||
73 | planet_h dw 195 |
||
74 | planet_d dw 30 |
||
75 | |||
76 | tors_r dw 10 |
||
77 | tors_R1 dw 100 |
||
78 | tors_R2 dw 150 |
||
79 | tors_R3 dw 200 |
||
80 | tors_a1 dw 6 |
||
81 | tors_a2 dw 3 |
||
82 | |||
83 | tor1_R dw 7 |
||
84 | tor1_r dd 1.8 |
||
85 | tor1_turns dd 25.132741228718345907701147066236 ; 2*4*pi |
||
86 | tor1_whorls dd 87.9645943005142106769540147318261 ; 7*4*pi |
||
87 | tor1_a dw 20 |
||
88 | |||
89 | galaxy_rq dw 45 |
||
90 | galaxy_rz dw 30 |
||
91 | galaxy_R dw 185 |
||
92 | galaxy_k dd 9.42477796076937971538793014983851 ; 3*pi |
||
93 | galaxy_A dw 230 |
||
94 | |||
95 | |||
96 | cubes_R dw 70 |
||
97 | |||
98 | explosion_R dw 230 |
||
99 | |||
100 | ;--------------------------------------------------------------------------- |
||
101 | ;----------------------- calculation figures ------------------------------- |
||
102 | ;--------------------------------------------------------------------------- |
||
103 | |||
104 | |||
105 | ;---------------------------- explosion ------------------------------------ |
||
106 | explosion: |
||
107 | fild word [esi] ; st0=alf |
||
108 | fmul [const_mpi] ; st0=a=pi*alf*malf |
||
109 | fsincos ; st0=cos(a) st1=sin(a) |
||
110 | fild [Fl] |
||
111 | fidiv [mFl] |
||
112 | fadd [al_r] |
||
113 | fsin |
||
114 | fimul [explosion_R] ; st0=R st1=cos(a) st2=sin(a) |
||
115 | fmul st2,st0 ; st0=R st1=cos(a) st2=R*sin(a) |
||
116 | fmulp st1,st0 ; st0=R*cos(a) st2=R*sin(a) |
||
117 | fild word [esi+2] ; st0=bet st1=R*cos(a) st2=R*sin(a) |
||
118 | fmul [const_mpi] ; st0=pi*bet*mbet st1=R*cos(a) st2=R*sin(a) |
||
119 | fsincos ; st0=cos(b) st1=sin(b) st2=R*cos(a) st3=R*sin(a) |
||
120 | fxch st2 ; st0=R*cos(a) st1=sin(b) st2=cos(b) st3=R*sin(a) |
||
121 | fmul st2,st0 ; st0=R*cos(a) st1=sin(b) st2=R*cos(a)*cos(b) st3=R*sin(a) |
||
122 | fmulp st1,st0 ; st0=R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) |
||
123 | ret |
||
124 | |||
125 | |||
126 | ;------------------------------ cubes -------------------------------------- |
||
127 | cubes: |
||
128 | push edx |
||
129 | xor edx,edx |
||
130 | mov eax,[Fl] |
||
131 | div [const6] |
||
132 | |||
133 | |||
134 | fild [cubes_R] ; st0=R |
||
135 | bt dx,0 |
||
136 | jc cubes_l0 |
||
137 | ; ax=xxxx xxxx xxxx xxx0b |
||
138 | fchs ; st0=-R |
||
139 | cubes_l0: |
||
140 | |||
141 | fild word [esi+2] ; st0=bet st1=R |
||
142 | fmul [const_m] ; st0=bet*mbet st1=R |
||
143 | fmul st0,st1 ; st0=R*bet*mbet st1=R |
||
144 | |||
145 | fild word [esi] ; st0=alf st1=R*bet*mbet st2=R |
||
146 | fmul [const_m] ; st0=alf*malf st1=R*bet*mbet st2=R |
||
147 | fmul st0,st2 ; st0=R*alf*malf st1=R*bet*mbet st2=R |
||
148 | |||
149 | bt dx,2 |
||
150 | jc cubes_l1 ; dx=xxxx xxxx xxxx x10xb |
||
151 | bt dx,1 |
||
152 | jc cubes_l2 ; dx=xxxx xxxx xxxx x01xb |
||
153 | ; dx=xxxx xxxx xxxx x00xb |
||
154 | fstp st3 |
||
155 | cubes_l1: |
||
156 | fstp st3 |
||
157 | cubes_l2: |
||
158 | |||
159 | div [const6] |
||
160 | |||
161 | fild [cubes_R] ; st0=R |
||
162 | fadd st0,st0 |
||
163 | bt dx,0 |
||
164 | jc cubes_l4 |
||
165 | ; ax=xxxx xxxx xxxx xxx0b |
||
166 | fchs ; st0=-R |
||
167 | cubes_l4: |
||
168 | faddp st1,st0 |
||
169 | |||
170 | bt dx,2 |
||
171 | jc cubes_l5 ; ax=xxxx xxxx xxxx x10xb |
||
172 | bt dx,1 |
||
173 | jc cubes_l6 ; ax=xxxx xxxx xxxx x01xb |
||
174 | ; ax=xxxx xxxx xxxx x00xb |
||
175 | fstp st3 |
||
176 | cubes_l5: |
||
177 | fstp st3 |
||
178 | cubes_l6: |
||
179 | |||
180 | pop edx |
||
181 | ret |
||
182 | |||
183 | |||
184 | ;----------------------------- galaxy -------------------------------------- |
||
185 | galaxy: |
||
186 | bt [Fl],0 |
||
187 | jc not_gal |
||
188 | fild [Fl] |
||
189 | fidiv [mFl] ; st0=f=Fl/mFl |
||
190 | fild word [esi+2] ; st0=bet st1=f |
||
191 | fmul [const_mpi] ; st0=b=pi*bet*mbet st1=f |
||
192 | fsincos ; st0=cos(b) st1=sin(b) st2=f |
||
193 | fild word [esi] ; st0=alf st1=cos(b) st2=sin(b) st3=f |
||
194 | fmul [const_m] ; st0=a=alf*malf st1=cos(b) st2=sin(b) st3=f |
||
195 | fmul st2,st0 ; st0=a st1=cos(b) st2=a*sin(b) st3=f |
||
196 | fmulp st1,st0 ; st0=a*cos(b) st1=a*sin(b) st2=f |
||
197 | fmul st0,st2 ; st0=f*a*cos(b) st1=a*sin(b) st2=f |
||
198 | fimul [galaxy_rz] ; st0=rz*f*a*cos(b) st1=a*sin(b) st2=f |
||
199 | fstp st3 ; st0=a*sin(b) st1=f st2=Z |
||
200 | fimul [galaxy_rq] ; st0=a*rq*sin(b) st1=f st2=Z |
||
201 | fiadd [galaxy_R] ; st0=R+a*rq*sin(b) st1=f st2=Z |
||
202 | fxch st1 ; st0=f st1=R+rq*a*sin(b) st2=Z |
||
203 | fmul st1,st0 ; st0=f st1=f*(R+rq*a*sin(b)) st2=Z |
||
204 | fmul [galaxy_k] ; st0=F=k*f st1=f*(R+rq*a*sin(b)) st2=Z |
||
205 | |||
206 | bt [Fl],1 |
||
207 | jc gal_lb |
||
208 | fldpi |
||
209 | faddp st1,st0 ; st0=F=F+pi st1=f*(R+rq*a*sin(b)) st2=Z |
||
210 | gal_lb: |
||
211 | |||
212 | fsincos ; st0=cos(F) st1=sin(F) st2=f*(R+rq*a*sin(b)) st3=Z |
||
213 | fxch st2 ; st0=f*(R+rq*a*sin(b)) st1=sin(F) st2=cos(F) st3=Z |
||
214 | fmul st2,st0 |
||
215 | fmulp st1,st0 ; st0=cos(F)*f*(R+rq*a*sin(b)) st1=sin(F)*f*(R+rq*a*sin(b)) st2=Z |
||
216 | ret |
||
217 | not_gal: |
||
218 | fild word [esi] ; st0=alf |
||
219 | fmul [const_mpi] ; st0=a=pi*alf*malf |
||
220 | fsincos ; st0=cos(a) st1=sin(a) |
||
221 | fild [Fl] ; st0=Fl st1=cos(a) st2=sin(a) |
||
222 | fidiv [mFl] ; st0=Fl/mFl st1=cos(a) st2=sin(a) |
||
223 | fmul st0,st0 |
||
224 | fmul st0,st0 |
||
225 | fmul st0,st0 |
||
226 | fst st3 |
||
227 | fimul [galaxy_A] ; st0=R=A*Fl/mFl st1=cos(a) st2=sin(a) |
||
228 | fmul st2,st0 ; st0=R st1=cos(a) st2=R*sin(a) |
||
229 | fmulp st1,st0 ; st0=R*cos(a) st2=R*sin(a) |
||
230 | fild word [esi+2] ; st0=bet st1=R*cos(a) st2=R*sin(a) |
||
231 | fmul [const_mpi] ; st0=pi*bet*mbet st1=R*cos(a) st2=R*sin(a) |
||
232 | fsincos ; st0=cos(b) st1=sin(b) st2=R*cos(a) st3=R*sin(a) |
||
233 | fxch st2 ; st0=R*cos(a) st1=sin(b) st2=cos(b) st3=R*sin(a) |
||
234 | fmul st2,st0 ; st0=R*cos(a) st1=sin(b) st2=R*cos(a)*cos(b) st3=R*sin(a) |
||
235 | fmulp st1,st0 ; st0=R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) |
||
236 | |||
237 | ; around Z |
||
238 | fld st1 |
||
239 | fld st1 ; st0=x st1=y st2=x st3=y st4=z |
||
240 | fld [al_r] ; st0=a st1=x st2=y st3=x st4=y st5=z |
||
241 | fchs |
||
242 | fmul st0,st6 |
||
243 | fsincos ; st0=cos(a) st1=sin(a) st2=x st3=y st4=x st5=y st6=z |
||
244 | fmul st4,st0 |
||
245 | fmulp st5,st0 |
||
246 | fmul st2,st0 |
||
247 | fmulp st1,st0 ; st0=x*sin(a) st1=y*sin(a) st2=x*cos(a) st3=y*cos(a) st4=z |
||
248 | faddp st3,st0 |
||
249 | fsubp st1,st0 |
||
250 | |||
251 | ffree st3 |
||
252 | ret |
||
253 | |||
254 | |||
255 | |||
256 | ;------------------------------ balls -------------------------------------- |
||
257 | balls: |
||
258 | mov eax,[Fl] |
||
259 | and eax,03h |
||
260 | |||
261 | fild word [esi] ; st0=alf |
||
262 | fmul [const_mpi] ; st0=a=pi*alf*malf |
||
263 | fsincos ; st0=cos(a) st1=sin(a) |
||
264 | fild [balls_R] ; st0=R st1=cos(a) st2=sin(a) |
||
265 | fmul st2,st0 ; st0=R st1=cos(a) st2=R*sin(a) |
||
266 | fmulp st1,st0 ; st0=R*cos(a) st2=R*sin(a) |
||
267 | fild word [esi+2] ; st0=bet st1=R*cos(a) st2=R*sin(a) |
||
268 | fmul [const_mpi] ; st0=pi*bet*mbet st1=R*cos(a) st2=R*sin(a) |
||
269 | fsincos ; st0=cos(b) st1=sin(b) st2=R*cos(a) st3=R*sin(a) |
||
270 | fxch st2 ; st0=R*cos(a) st1=sin(b) st2=cos(b) st3=R*sin(a) |
||
271 | fmul st2,st0 ; st0=R*cos(a) st1=sin(b) st2=R*cos(a)*cos(b) st3=R*sin(a) |
||
272 | fmulp st1,st0 ; st0=R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) |
||
273 | |||
274 | fiadd [balls_y1+2*eax] ; st0=y+R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) |
||
275 | fxch st1 ; st0=R*cos(a)*cos(b) st1=y+R*cos(a)*sin(b) st2=R*sin(a) |
||
276 | fiadd [balls_z1+2*eax] ; st0=z+R*cos(a)*cos(b) st1=y+R*cos(a)*sin(b) st2=R*sin(a) |
||
277 | fxch st2 ; st0=R*sin(a) st1=y+R*cos(a)*sin(b) st2=z+R*cos(a)*cos(b) |
||
278 | fiadd [balls_x1+2*eax] ; st0=x+R*sin(a) st1=y+R*cos(a)*sin(b) st2=z+R*cos(a)*cos(b) |
||
279 | ret |
||
280 | |||
281 | |||
282 | ;------------------------------- sin --------------------------------------- |
||
283 | sin: |
||
284 | test [Fl],3Fh |
||
285 | |||
286 | fild word [esi] ; st0=alf |
||
287 | |||
288 | jnz sin_lb1 |
||
289 | fmul [const_mpi] ; st0=a=pi*alf*malf |
||
290 | fsincos ; st0=cos(a) st1=sin(a) |
||
291 | fild [sin_R] ; st0=R st1=cos(a) st2=sin(a) |
||
292 | fmul st2,st0 ; st0=R st1=cos(a) st2=R*sin(a) |
||
293 | fmulp st1,st0 ; st0=R*cos(a) st2=R*sin(a) |
||
294 | fild word [esi+2] ; st0=bet st1=R*cos(a) st2=R*sin(a) |
||
295 | fmul [const_mpi] ; st0=b=pi*bet*mbet st1=R*cos(a) st2=R*sin(a) |
||
296 | fsincos ; st0=cos(b) st1=sin(b) st2=R*cos(a) st3=R*sin(a) |
||
297 | fxch st2 ; st0=R*cos(a) st1=sin(b) st2=cos(b) st3=R*sin(a) |
||
298 | fmul st2,st0 ; st0=R*cos(a) st1=sin(b) st2=R*cos(a)*cos(b) st3=R*sin(a) |
||
299 | fmulp st1,st0 ; st0=R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) |
||
300 | fiadd [sin_A] ; st0=A+R*cos(b)*sin(a) st2=R*cos(a)*cos(b) st3=R*sin(a) |
||
301 | ret |
||
302 | |||
303 | sin_lb1: |
||
304 | fmul [const_m] ; st0=alf*malf |
||
305 | fild word [esi+2] ; st0=bet st1=alf*malf |
||
306 | fmul [const_m] ; st0=bet*mbet st1=alf*malf |
||
307 | |||
308 | fld st0 ; st0=bet*mbet st1=bet*mbet st2=alf*malf |
||
309 | fmul st0,st0 ; st0=(bet*mbet)^2 st1=bet*mbet st2=alf*malf |
||
310 | fld st2 ; st0=alf*malf st1=(bet*mbet)^2 st2=bet*mbet st3=alf*malf |
||
311 | fmul st0,st0 ; st0=(alf*malf)^2 st1=(bet*mbet)^2 st2=bet*mbet st3=alf*malf |
||
312 | faddp st1,st0 ; st0=(alf*malf)^2+(bet*mbet)^2 st1=bet*mbet st2=alf*malf |
||
313 | fsqrt ; st0=r=sqr((alf*malf)^2*(bet*mbet)^2) st1=bet*mbet st2=alf*malf |
||
314 | fild [sin_k] ; st0=k st1=r st2=bet*mbet st3=alf*malf |
||
315 | fmul st0,st1 ; st0=k*r st1=r st2=bet*mbet st3=alf*malf |
||
316 | fsin ; st0=sin(k*r) st1=r st2=bet*mbet st3=alf*malf |
||
317 | fdivrp st1,st0 ; st0=sin(k*r)/r st1=bet*mbet st2=alf*malf |
||
318 | fimul [sin_c] ; st0=c*sin(k*r)/r st1=bet*mbet st2=alf*malf |
||
319 | |||
320 | fild [sin_a] ; st0=a st1=c*sin(k*r)/r st2=bet*mbet st3=alf*malf |
||
321 | fmul st2,st0 ; st0=a st1=c*sin(k*r)/r st2=a*bet*mbet st3=alf*malf |
||
322 | fmulp st3,st0 ; st0=c*sin(k*r)/r st1=a*bet*mbet st2=a*alf*malf |
||
323 | ret |
||
324 | |||
325 | |||
326 | ;------------------------------ tors --------------------------------------- |
||
327 | tors: |
||
328 | push edx |
||
329 | xor edx,edx |
||
330 | mov eax,[Fl] |
||
331 | div [const3] |
||
332 | mov al,dl |
||
333 | pop edx |
||
334 | |||
335 | fild word [esi] ; st0=alf |
||
336 | fmul [const_mpi] ; st0=a=pi*alf*malf |
||
337 | fsincos ; st0=cos(a) st1=sin(a) |
||
338 | fild [tors_r] ; st0=r st1=cos(a) st2=sin(a) |
||
339 | fmul st2,st0 ; st0=r st1=cos(a) st2=r*sin(a) |
||
340 | fmulp st1,st0 ; st0=r*cos(a) st1=r*sin(a) |
||
341 | bt ax,1 |
||
342 | jc tors_l1 ; ax=xxxx xxxx xxxx xx1xb |
||
343 | bt ax,0 |
||
344 | jc tors_l2 ; ax=xxxx xxxx xxxx xxx1b |
||
345 | fiadd [tors_R3] ; st0=r*cos(a)+R st1=r*sin(a) |
||
346 | fild word [esi+2] ; st0=bet st1=r*cos(a)+R st2=r*sin(a) |
||
347 | fmul [const_mpi] ; st0=b=pi*bet*mbet st1=r*cos(a)+R st2=r*sin(a) |
||
348 | fsincos ; st0=cos(b) st1=sin(b) st2=r*cos(a)+R st3=r*sin(a) |
||
349 | fxch st2 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b) st3=r*sin(a) |
||
350 | fmul st2,st0 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b)*(r*cos(a)+R) st3=r*sin(a) |
||
351 | fmulp st1,st0 ; st0=sin(b)*(r*cos(a)+R) st1=cos(b)*(r*cos(a)+R) st2=r*sin(a) |
||
352 | ret |
||
353 | |||
354 | tors_l1: |
||
355 | fiadd [tors_R2] ; st0=r*cos(a)+R st1=r*sin(a) |
||
356 | fild word [esi+2] ; st0=bet st1=r*cos(a)+R st2=r*sin(a) |
||
357 | fmul [const_mpi] ; st0=b=pi*bet*mbet st1=r*cos(a)+R st2=r*sin(a) |
||
358 | fsincos ; st0=cos(b) st1=sin(b) st2=r*cos(a)+R st3=r*sin(a) |
||
359 | fxch st2 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b) st3=r*sin(a) |
||
360 | fmul st2,st0 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b)*(r*cos(a)+R) st3=r*sin(a) |
||
361 | fmulp st1,st0 ; st0=sin(b)*(r*cos(a)+R) st1=cos(b)*(r*cos(a)+R) st2=r*sin(a) |
||
362 | jmp tors_l3 |
||
363 | |||
364 | tors_l2: |
||
365 | fiadd [tors_R1] ; st0=r*cos(a)+R st1=r*sin(a) |
||
366 | fild word [esi+2] ; st0=bet st1=r*cos(a)+R st2=r*sin(a) |
||
367 | fmul [const_mpi] ; st0=b=pi*bet*mbet st1=r*cos(a)+R st2=r*sin(a) |
||
368 | fsincos ; st0=cos(b) st1=sin(b) st2=r*cos(a)+R st3=r*sin(a) |
||
369 | fxch st2 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b) st3=r*sin(a) |
||
370 | fmul st2,st0 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b)*(r*cos(a)+R) st3=r*sin(a) |
||
371 | fmulp st1,st0 ; st0=sin(b)*(r*cos(a)+R) st1=cos(b)*(r*cos(a)+R) st2=r*sin(a) |
||
372 | |||
373 | |||
374 | ; around Y |
||
375 | ; x= x*cos(a)-z*sin(a) |
||
376 | ; y= y |
||
377 | ; z= x*sin(a)+z*cos(a) |
||
378 | fld st2 ; st0=z st1=x st2=y st3=z |
||
379 | fld st1 ; st0=x st1=z st2=x st3=y st4=z |
||
380 | fld [al_r] |
||
381 | fimul [tors_a1] ; st0=a st1=x st2=z st3=x st4=y st5=z |
||
382 | fsincos ; st0=cos(a) st1=sin(a) st2=x st3=z st4=x st5=y st6=z |
||
383 | fmul st4,st0 |
||
384 | fmulp st6,st0 ; st0=sin(a) st1=x st2=z st3=x*cos(a) st4=y st5=z*cos(a) |
||
385 | fmul st2,st0 |
||
386 | fmulp st1,st0 ; st0=x*sin(a) st1=z*sin(a) st2=x*cos(a) st3=y st4=z*cos(a) |
||
387 | faddp st4,st0 |
||
388 | fsubp st1,st0 |
||
389 | |||
390 | tors_l3: |
||
391 | ; around X |
||
392 | ; x=x |
||
393 | ; y= y*cos(b)+z*sin(b) |
||
394 | ; z=-y*sin(b)+z*cos(b) |
||
395 | fld st2 ; st0=z st1=x st2=y st3=z |
||
396 | fld st2 ; st0=y st1=z st2=x st3=y st4=z |
||
397 | fld [al_r] |
||
398 | fimul [tors_a2] ; st0=b st1=y st2=z st3=x st4=y st5=z |
||
399 | fsincos ; st0=cos(b) st1=sin(b) st2=y st3=z st4=x st5=y st6=z |
||
400 | fmul st5,st0 |
||
401 | fmulp st6,st0 ; st0=sin(b) st1=y st2=z st3=x st4=y*cos(b) st5=z*cos(b) |
||
402 | fmul st2,st0 |
||
403 | fmulp st1,st0 ; st0=y*sin(b) st1=z*sin(b) st2=x st3=y*cos(b) st4=z*cos(b) |
||
404 | fsubp st4,st0 ; st0=z*sin(b) st1=x st2=y*cos(b) st3=z*cos(b)-y*sin(b) |
||
405 | faddp st2,st0 |
||
406 | ret |
||
407 | |||
408 | |||
409 | ;------------------------------ tor1 --------------------------------------- |
||
410 | tor1: |
||
411 | fild [tor1_a] ; st0=a |
||
412 | fild word [esi+2] ; st0=bet st1=a |
||
413 | fmul [const_mpi] ; st0=b=pi*bet*mbet st1=a |
||
414 | fsincos ; st0=cos(b) st1=sin(b) st2=a |
||
415 | fild word [esi] ; st0=alf st1=cos(b) st2=sin(b) st3=a |
||
416 | fmul [const_m] ; st0=alf*malf st1=cos(b) st2=sin(b) st3=a |
||
417 | fld st0 ; st0=alf*malf st1=alf*malf st2=cos(b) st3=sin(b) st4=a |
||
418 | fmul [tor1_whorls] ; st0=wa=whorls*alf*malf st1=alf*malf st2=cos(b) st3=sin(b) st4=a |
||
419 | fsincos ; st0=cos(wa) st1=sin(wa) st2=alf*malf st3=cos(b) st4=sin(b) st5=a |
||
420 | fld [tor1_r] ; st0=r st1=cos(wa) st2=sin(wa) st3=alf*malf st4=cos(b) st5=sin(b) st6=a |
||
421 | fmul st2,st0 ; st0=r st1=cos(wa) st2=r*sin(wa) st3=alf*malf st4=cos(b) st5=sin(b) st6=a |
||
422 | fmulp st1,st0 ; st0=r*cos(wa) st1=r*sin(wa) st2=alf*malf st3=cos(b) st4=sin(b) st5=a |
||
423 | fiadd [tor1_R] ; st0=R+r*cos(wa) st1=r*sin(wa) st2=alf*malf st3=cos(b) st4=sin(b) st5=a |
||
424 | faddp st3,st0 ; st0=r*sin(wa) st1=alf*malf st2=R+r*cos(wa)+cos(b) st3=sin(b) st4=a |
||
425 | faddp st3,st0 ; st0=alf*malf st1=R+r*cos(wa)+cos(b) st2=r*sin(wa)+sin(b) st3=a |
||
426 | fmul [tor1_turns] ; st0=ta=turns*alf*malf st1=R+r*cos(wa)+cos(b) st2=r*sin(wa)+sin(b) st3=a |
||
427 | fsincos ; st0=cos(ta) st1=sin(ta) st2=R+r*cos(wa)+cos(b) st3=r*sin(wa)+sin(b) st4=a |
||
428 | fmul st0,st2 ; st0=cos(ta)*(R+r*cos(wa)+cos(b)) st1=sin(ta) st2=R+r*cos(wa)+cos(b) st3=r*sin(wa)+sin(b) st4=a |
||
429 | fmul st0,st4 ; st0=a*cos(ta)*(R+r*cos(wa)+cos(b)) st1=sin(ta) st2=R+r*cos(wa)+cos(b) st3=r*sin(wa)+sin(b) st4=a |
||
430 | fstp st5 ; st0=sin(ta) st1=R+r*cos(wa)+cos(b) st2=r*sin(wa)+sin(b) st3=a st4=y |
||
431 | fmulp st1,st0 ; st0=sin(ta)*(R+r*cos(wa)+cos(b)) st1=r*sin(wa)+sin(b) st2=a st3=y |
||
432 | fmul st0,st2 ; st0=z=a*sin(ta)*(R+r*cos(wa)+cos(b)) st1=r*sin(wa)+sin(b) st2=a st3=y |
||
433 | fstp st4 ; st0=r*sin(wa)+sin(b) st1=a st2=y st3=z |
||
434 | fmulp st1,st0 ; st0=x=a*(r*sin(wa)+sin(b)) st1=y st2=z |
||
435 | ret |
||
436 | |||
437 | |||
438 | |||
439 | ;------------------------------- tor --------------------------------------- |
||
440 | tor: |
||
441 | fild word [esi] ; st0=alf |
||
442 | fmul [const_mpi] ; st0=a=pi*alf*malf |
||
443 | fsincos ; st0=cos(a) st1=sin(a) |
||
444 | fild [tor_r] ; st0=r st1=cos(a) st2=sin(a) |
||
445 | fmul st2,st0 ; st0=r st1=cos(a) st2=r*sin(a) |
||
446 | fmulp st1,st0 ; st0=r*cos(a) st1=r*sin(a) |
||
447 | fiadd [tor_R] ; st0=r*cos(a)+R st1=r*sin(a) |
||
448 | fild word [esi+2]; st0=bet st1=r*cos(a)+R st2=r*sin(a) |
||
449 | fmul [const_mpi] ; st0=b=pi*bet*mbet st1=r*cos(a)+R st2=r*sin(a) |
||
450 | fsincos ; st0=cos(b) st1=sin(b) st2=r*cos(a)+R st3=r*sin(a) |
||
451 | fxch st2 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b) st3=r*sin(a) |
||
452 | fmul st2,st0 ; st0=r*cos(a)+R st1=sin(b) st2=cos(b)*(r*cos(a)+R) st3=r*sin(a) |
||
453 | fmulp st1,st0 ; st0=sin(b)*(r*cos(a)+R) st1=cos(b)*(r*cos(a)+R) st2=r*sin(a) |
||
454 | ret |
||
455 | |||
456 | |||
457 | ;------------------------------ spiral ------------------------------------- |
||
458 | spiral: |
||
459 | fild word [esi+2] ; st0=bet |
||
460 | fmul [const_m] ; st0=bet*mbet |
||
461 | fild word [esi] ; st0=alf st1=bet*mbet |
||
462 | fmul [const_mpi] ; st0=a=pi*alf*malf st1=bet*mbet |
||
463 | fsincos ; st0=cos(a) st1=sin(a) st2=bet*mbet |
||
464 | fimul [spiral_r] ; st0=r*cos(a) st1=sin(a) st2=bet*mbet |
||
465 | fld st2 ; st0=bet*mbet st1=r*cos(a) st2=sin(a) st3=bet*mbet |
||
466 | fimul [spiral_h] ; st0=bet*mbet*h st1=r*cos(a) st2=sin(a) st3=bet*mbet |
||
467 | faddp st1,st0 ; st0=z=bet*mbet*h+r*cos(a) st1=sin(a) st2=bet*mbet |
||
468 | fstp st3 ; st0=sin(a) st1=bet*mbet st2=z |
||
469 | fimul [spiral_r] ; st0=r*sin(a) st1=bet*mbet st2=z |
||
470 | fiadd [spiral_R] ; st0=r*sin(a)+R st1=bet*mbet st2=z |
||
471 | fxch st1 ; st0=bet*mbet st1=r*sin(a)+R st2=z |
||
472 | fimul [spiral_L] ; st0=b=L*bet*mbet st1=r*sin(a)+R st2=z |
||
473 | fsincos ; st0=cos(b) st1=sin(b) st2=r*sin(a)+R st3=z |
||
474 | fxch st2 ; st0=r*sin(a)+R st1=sin(b) st2=cos(b) st3=z |
||
475 | fmul st2,st0 ; st0=r*sin(a)+R st1=sin(b) st2=(r*sin(a)+R)*cos(b) st3=z |
||
476 | fmulp st1,st0 ; st0=x=(r*sin(a)+R)*sin(b) st2=y=(r*sin(a)+R)*cos(b) st3=z |
||
477 | ret |
||
478 | |||
479 | |||
480 | ;------------------------------- cube -------------------------------------- |
||
481 | cube: |
||
482 | push edx |
||
483 | xor edx,edx |
||
484 | mov eax,[Fl] |
||
485 | div [const6] |
||
486 | |||
487 | fild [cube_R] ; st0=R |
||
488 | bt dx,0 |
||
489 | jc cube_l0 |
||
490 | ; dx=xxxx xxxx xxxx xxx0b |
||
491 | fchs ; st0=-R |
||
492 | cube_l0: |
||
493 | |||
494 | fild word [esi+2] ; st0=bet st1=R |
||
495 | fmul [const_m] ; st0=bet*mbet st1=R |
||
496 | fmul st0,st1 ; st0=R*bet*mbet st1=R |
||
497 | |||
498 | fild word [esi] ; st0=alf st1=R*bet*mbet st2=R |
||
499 | fmul [const_m] ; st0=alf*malf st1=R*bet*mbet st2=R |
||
500 | fmul st0,st2 ; st0=R*alf*malf st1=R*bet*mbet st2=R |
||
501 | |||
502 | bt dx,2 |
||
503 | jc cube_l1 ; dx=xxxx xxxx xxxx x10xb |
||
504 | bt dx,1 |
||
505 | jc cube_l2 ; dx=xxxx xxxx xxxx x01xb |
||
506 | ; dx=xxxx xxxx xxxx x00xb |
||
507 | fstp st3 |
||
508 | cube_l1: |
||
509 | fstp st3 |
||
510 | cube_l2: |
||
511 | pop edx |
||
512 | ret |
||
513 | |||
514 | |||
515 | ;------------------------------ planet ------------------------------------- |
||
516 | planet: |
||
517 | bt [Fl],0 |
||
518 | jc planet_lb1 |
||
519 | |||
520 | bt [Fl],1 |
||
521 | jc planet_lb0 |
||
522 | fild word [esi] ; st0=alf |
||
523 | fmul [const_mpi] ; st0=a=pi*alf*malf |
||
524 | fsincos ; st0=cos(a) st1=sin(a) |
||
525 | fild [planet_R] ; st0=R st1=cos(a) st2=sin(a) |
||
526 | fmul st2,st0 ; st0=R st1=cos(a) st2=R*sin(a) |
||
527 | fmulp st1,st0 ; st0=R*cos(a) st2=R*sin(a) |
||
528 | fild word [esi+2] ; st0=bet st1=R*cos(a) st2=R*sin(a) |
||
529 | fmul [const_mpi] ; st0=b=pi*bet*mbet st1=R*cos(a) st2=R*sin(a) |
||
530 | fsincos ; st0=cos(b) st1=sin(b) st2=R*cos(a) st3=R*sin(a) |
||
531 | fxch st2 ; st0=R*cos(a) st1=sin(b) st2=cos(b) st3=R*sin(a) |
||
532 | fmul st2,st0 ; st0=R*cos(a) st1=sin(b) st2=R*cos(a)*cos(b) st3=R*sin(a) |
||
533 | fmulp st1,st0 ; st0=R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) |
||
534 | ret |
||
535 | planet_lb0: |
||
536 | fild word [esi] ; st0=alf |
||
537 | fmul [const_mpi] ; st0=a=pi*alf*malf |
||
538 | fsincos ; st0=cos(a) st1=sin(a) |
||
539 | fild [planet_r] ; st0=R st1=cos(a) st2=sin(a) |
||
540 | fmul st2,st0 ; st0=R st1=cos(a) st2=R*sin(a) |
||
541 | fmulp st1,st0 ; st0=R*cos(a) st2=R*sin(a) |
||
542 | fild word [esi+2] ; st0=bet st1=R*cos(a) st2=R*sin(a) |
||
543 | fmul [const_mpi] ; st0=b=pi*bet*mbet st1=R*cos(a) st2=R*sin(a) |
||
544 | fsincos ; st0=cos(b) st1=sin(b) st2=R*cos(a) st3=R*sin(a) |
||
545 | fxch st2 ; st0=R*cos(a) st1=sin(b) st2=cos(b) st3=R*sin(a) |
||
546 | fmul st2,st0 ; st0=R*cos(a) st1=sin(b) st2=R*cos(a)*cos(b) st3=R*sin(a) |
||
547 | fmulp st1,st0 ; st0=R*cos(a)*sin(b) st1=R*cos(a)*cos(b) st2=R*sin(a) |
||
548 | fiadd [planet_h] ; st0=R*cos(a)*sin(b)+h st1=R*cos(a)*cos(b) st2=R*sin(a) |
||
549 | fxch st1 ; st0=R*cos(a)*cos(b) st1=R*cos(a)*sin(b)+h st2=R*sin(a) |
||
550 | ret |
||
551 | planet_lb1: |
||
552 | fild word [esi+2] ; st0=bet |
||
553 | fmul [const_m] ; st0=bet*mbet |
||
554 | fimul [planet_d] ; st0=d*bet*mbet |
||
555 | fiadd [planet_h] ; st0=h+d*bet*mbet |
||
556 | fild word [esi] ; st0=alf st1=h+d*bet*mbet |
||
557 | fmul [const_mpi] ; st0=a=pi*alf*malf st1=h+d*bet*mbet |
||
558 | fsincos ; st0=cos(a) st1=sin(a) st2=h+d*bet*mbet |
||
559 | fxch st2 ; st0=h+d*bet*mbet st1=sin(a) st2=cos(a) |
||
560 | fmul st2,st0 ; st0=h+d*bet*mbet st1=sin(a) st2=cos(a)*(h+d*bet*mbet) |
||
561 | fmulp st1,st0 ; st0=(h+d*bet*mbet)*sin(a) st1=cos(a)*(h+d*bet*mbet) |
||
562 | fldz ; st0=0 st1=(h+d*bet*mbet)*sin(a) st2=cos(a)*(h+d*bet*mbet) |
||
563 | ret=mFl |
||
564 |