The Build Engine

- Main Page
- Classes
- Files

- File List
- File Members

pragmas.h
1 /*
2 * "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
3 * Ken Silverman's official web site: "http://www.advsys.net/ken"
4 * See the included license file "BUILDLIC.TXT" for license info.
5 * This file has been modified from Ken Silverman's original release
6 */
7
8 #ifndef __PRAGMAS_H__
9 #define __PRAGMAS_H__
10
11 #if (defined __WATCOMC__)
12
13 static long dmval = 0;
14
15 long is_vmware_running(void);
16 #pragma aux is_vmware_running modify exact [eax ebx ecx edx];
17
18 unsigned long getkensmessagecrc(long param);
19 #pragma aux getkensmessagecrc =\
20 "xor eax, eax",\
21 "mov ecx, 32",\
22 "beg: mov edx, dword ptr [ebx+ecx*4-4]",\
23 "ror edx, cl",\
24 "adc eax, edx",\
25 "bswap eax",\
26 "loop short beg",\
27 parm [ebx]\
28 modify exact [eax ebx ecx edx]\
29
30 long msqrtasm(int param);
31 #pragma aux msqrtasm =\
32 "mov eax, 0x40000000",\
33 "mov ebx, 0x20000000",\
34 "begit: cmp ecx, eax",\
35 "jl skip",\
36 "sub ecx, eax",\
37 "lea eax, [eax+ebx*4]",\
38 "skip: sub eax, ebx",\
39 "shr eax, 1",\
40 "shr ebx, 2",\
41 "jnz begit",\
42 "cmp ecx, eax",\
43 "sbb eax, -1",\
44 "shr eax, 1",\
45 parm nomemory [ecx]\
46 modify exact [eax ebx ecx]\
47
48 int sqr(int i1);
49 #pragma aux sqr =\
50 "imul eax, eax",\
51 parm nomemory [eax]\
52 modify exact [eax]\
53 value [eax]
54
55 long scale(long i1, long i2, long i3);
56 #pragma aux scale =\
57 "imul edx",\
58 "idiv ecx",\
59 parm nomemory [eax][edx][ecx]\
60 modify exact [eax edx]\
61
62 long mulscale(long i1, long i2, long i3);
63 #pragma aux mulscale =\
64 "imul edx",\
65 "shrd eax, edx, cl",\
66 parm nomemory [eax][edx][ecx]\
67 modify exact [eax edx]\
68
69 long mulscale1(long i1, long i2);
70 #pragma aux mulscale1 =\
71 "imul edx",\
72 "shrd eax, edx, 1",\
73 parm nomemory [eax][edx]\
74 modify exact [eax edx]\
75
76 long mulscale2(long i1, long i2);
77 #pragma aux mulscale2 =\
78 "imul edx",\
79 "shrd eax, edx, 2",\
80 parm nomemory [eax][edx]\
81 modify exact [eax edx]\
82
83 long mulscale3(long i1, long i2);
84 #pragma aux mulscale3 =\
85 "imul edx",\
86 "shrd eax, edx, 3",\
87 parm nomemory [eax][edx]\
88 modify exact [eax edx]\
89
90 long mulscale4(long i1, long i2);
91 #pragma aux mulscale4 =\
92 "imul edx",\
93 "shrd eax, edx, 4",\
94 parm nomemory [eax][edx]\
95 modify exact [eax edx]\
96
97 long mulscale5(long i1, long i2);
98 #pragma aux mulscale5 =\
99 "imul edx",\
100 "shrd eax, edx, 5",\
101 parm nomemory [eax][edx]\
102 modify exact [eax edx]\
103
104 long mulscale6(long i1, long i2);
105 #pragma aux mulscale6 =\
106 "imul edx",\
107 "shrd eax, edx, 6",\
108 parm nomemory [eax][edx]\
109 modify exact [eax edx]\
110
111 long mulscale7(long i1, long i2);
112 #pragma aux mulscale7 =\
113 "imul edx",\
114 "shrd eax, edx, 7",\
115 parm nomemory [eax][edx]\
116 modify exact [eax edx]\
117
118 long mulscale8(long i1, long i2);
119 #pragma aux mulscale8 =\
120 "imul edx",\
121 "shrd eax, edx, 8",\
122 parm nomemory [eax][edx]\
123 modify exact [eax edx]\
124
125 long mulscale9(long i1, long i2);
126 #pragma aux mulscale9 =\
127 "imul edx",\
128 "shrd eax, edx, 9",\
129 parm nomemory [eax][edx]\
130 modify exact [eax edx]\
131
132 long mulscale10(long i1, long i2);
133 #pragma aux mulscale10 =\
134 "imul edx",\
135 "shrd eax, edx, 10",\
136 parm nomemory [eax][edx]\
137 modify exact [eax edx]\
138
139 long mulscale11(long i1, long i2);
140 #pragma aux mulscale11 =\
141 "imul edx",\
142 "shrd eax, edx, 11",\
143 parm nomemory [eax][edx]\
144 modify exact [eax edx]\
145
146 long mulscale12(long i1, long i2);
147 #pragma aux mulscale12 =\
148 "imul edx",\
149 "shrd eax, edx, 12",\
150 parm nomemory [eax][edx]\
151 modify exact [eax edx]\
152
153 long mulscale13(long i1, long i2);
154 #pragma aux mulscale13 =\
155 "imul edx",\
156 "shrd eax, edx, 13",\
157 parm nomemory [eax][edx]\
158 modify exact [eax edx]\
159
160 long mulscale14(long i1, long i2);
161 #pragma aux mulscale14 =\
162 "imul edx",\
163 "shrd eax, edx, 14",\
164 parm nomemory [eax][edx]\
165 modify exact [eax edx]\
166
167 long mulscale15(long i1, long i2);
168 #pragma aux mulscale15 =\
169 "imul edx",\
170 "shrd eax, edx, 15",\
171 parm nomemory [eax][edx]\
172 modify exact [eax edx]\
173
174 long mulscale16(long i1, long i2);
175 #pragma aux mulscale16 =\
176 "imul edx",\
177 "shrd eax, edx, 16",\
178 parm nomemory [eax][edx]\
179 modify exact [eax edx]\
180
181 long mulscale17(long i1, long i2);
182 #pragma aux mulscale17 =\
183 "imul edx",\
184 "shrd eax, edx, 17",\
185 parm nomemory [eax][edx]\
186 modify exact [eax edx]\
187
188 long mulscale18(long i1, long i2);
189 #pragma aux mulscale18 =\
190 "imul edx",\
191 "shrd eax, edx, 18",\
192 parm nomemory [eax][edx]\
193 modify exact [eax edx]\
194
195 long mulscale19(long i1, long i2);
196 #pragma aux mulscale19 =\
197 "imul edx",\
198 "shrd eax, edx, 19",\
199 parm nomemory [eax][edx]\
200 modify exact [eax edx]\
201
202 long mulscale20(long i1, long i2);
203 #pragma aux mulscale20 =\
204 "imul edx",\
205 "shrd eax, edx, 20",\
206 parm nomemory [eax][edx]\
207 modify exact [eax edx]\
208
209 long mulscale21(long i1, long i2);
210 #pragma aux mulscale21 =\
211 "imul edx",\
212 "shrd eax, edx, 21",\
213 parm nomemory [eax][edx]\
214 modify exact [eax edx]\
215
216 long mulscale22(long i1, long i2);
217 #pragma aux mulscale22 =\
218 "imul edx",\
219 "shrd eax, edx, 22",\
220 parm nomemory [eax][edx]\
221 modify exact [eax edx]\
222
223 long mulscale23(long i1, long i2);
224 #pragma aux mulscale23 =\
225 "imul edx",\
226 "shrd eax, edx, 23",\
227 parm nomemory [eax][edx]\
228 modify exact [eax edx]\
229
230 long mulscale24(long i1, long i2);
231 #pragma aux mulscale24 =\
232 "imul edx",\
233 "shrd eax, edx, 24",\
234 parm nomemory [eax][edx]\
235 modify exact [eax edx]\
236
237 long mulscale25(long i1, long i2);
238 #pragma aux mulscale25 =\
239 "imul edx",\
240 "shrd eax, edx, 25",\
241 parm nomemory [eax][edx]\
242 modify exact [eax edx]\
243
244 long mulscale26(long i1, long i2);
245 #pragma aux mulscale26 =\
246 "imul edx",\
247 "shrd eax, edx, 26",\
248 parm nomemory [eax][edx]\
249 modify exact [eax edx]\
250
251 long mulscale27(long i1, long i2);
252 #pragma aux mulscale27 =\
253 "imul edx",\
254 "shrd eax, edx, 27",\
255 parm nomemory [eax][edx]\
256 modify exact [eax edx]\
257
258 long mulscale28(long i1, long i2);
259 #pragma aux mulscale28 =\
260 "imul edx",\
261 "shrd eax, edx, 28",\
262 parm nomemory [eax][edx]\
263 modify exact [eax edx]\
264
265 long mulscale29(long i1, long i2);
266 #pragma aux mulscale29 =\
267 "imul edx",\
268 "shrd eax, edx, 29",\
269 parm nomemory [eax][edx]\
270 modify exact [eax edx]\
271
272 long mulscale30(long i1, long i2);
273 #pragma aux mulscale30 =\
274 "imul edx",\
275 "shrd eax, edx, 30",\
276 parm nomemory [eax][edx]\
277 modify exact [eax edx]\
278
279 long mulscale31(long i1, long i2);
280 #pragma aux mulscale31 =\
281 "imul edx",\
282 "shrd eax, edx, 31",\
283 parm nomemory [eax][edx]\
284 modify exact [eax edx]\
285
286 long mulscale32(long i1, long i2);
287 #pragma aux mulscale32 =\
288 "imul edx",\
289 parm nomemory [eax][edx]\
290 modify exact [eax edx]\
291 value [edx]\
292
293 long dmulscale(long i1, long i2, long i3, long i4, long i5);
294 #pragma aux dmulscale =\
295 "imul edx",\
296 "mov ebx, eax",\
297 "mov eax, esi",\
298 "mov esi, edx",\
299 "imul edi",\
300 "add eax, ebx",\
301 "adc edx, esi",\
302 "shrd eax, edx, cl",\
303 parm nomemory [eax][edx][esi][edi][ecx]\
304 modify exact [eax ebx edx esi]\
305
306 long dmulscale1(long i1, long i2, long i3, long i4);
307 #pragma aux dmulscale1 =\
308 "imul edx",\
309 "mov ebx, eax",\
310 "mov eax, esi",\
311 "mov esi, edx",\
312 "imul edi",\
313 "add eax, ebx",\
314 "adc edx, esi",\
315 "shrd eax, edx, 1",\
316 parm nomemory [eax][edx][esi][edi]\
317 modify exact [eax ebx edx esi]\
318
319 long dmulscale2(long i1, long i2, long i3, long i4);
320 #pragma aux dmulscale2 =\
321 "imul edx",\
322 "mov ebx, eax",\
323 "mov eax, esi",\
324 "mov esi, edx",\
325 "imul edi",\
326 "add eax, ebx",\
327 "adc edx, esi",\
328 "shrd eax, edx, 2",\
329 parm nomemory [eax][edx][esi][edi]\
330 modify exact [eax ebx edx esi]\
331
332 long dmulscale3(long i1, long i2, long i3, long i4);
333 #pragma aux dmulscale3 =\
334 "imul edx",\
335 "mov ebx, eax",\
336 "mov eax, esi",\
337 "mov esi, edx",\
338 "imul edi",\
339 "add eax, ebx",\
340 "adc edx, esi",\
341 "shrd eax, edx, 3",\
342 parm nomemory [eax][edx][esi][edi]\
343 modify exact [eax ebx edx esi]\
344
345 long dmulscale4(long i1, long i2, long i3, long i4);
346 #pragma aux dmulscale4 =\
347 "imul edx",\
348 "mov ebx, eax",\
349 "mov eax, esi",\
350 "mov esi, edx",\
351 "imul edi",\
352 "add eax, ebx",\
353 "adc edx, esi",\
354 "shrd eax, edx, 4",\
355 parm nomemory [eax][edx][esi][edi]\
356 modify exact [eax ebx edx esi]\
357
358 long dmulscale5(long i1, long i2, long i3, long i4);
359 #pragma aux dmulscale5 =\
360 "imul edx",\
361 "mov ebx, eax",\
362 "mov eax, esi",\
363 "mov esi, edx",\
364 "imul edi",\
365 "add eax, ebx",\
366 "adc edx, esi",\
367 "shrd eax, edx, 5",\
368 parm nomemory [eax][edx][esi][edi]\
369 modify exact [eax ebx edx esi]\
370
371 long dmulscale6(long i1, long i2, long i3, long i4);
372 #pragma aux dmulscale6 =\
373 "imul edx",\
374 "mov ebx, eax",\
375 "mov eax, esi",\
376 "mov esi, edx",\
377 "imul edi",\
378 "add eax, ebx",\
379 "adc edx, esi",\
380 "shrd eax, edx, 6",\
381 parm nomemory [eax][edx][esi][edi]\
382 modify exact [eax ebx edx esi]\
383
384 long dmulscale7(long i1, long i2, long i3, long i4);
385 #pragma aux dmulscale7 =\
386 "imul edx",\
387 "mov ebx, eax",\
388 "mov eax, esi",\
389 "mov esi, edx",\
390 "imul edi",\
391 "add eax, ebx",\
392 "adc edx, esi",\
393 "shrd eax, edx, 7",\
394 parm nomemory [eax][edx][esi][edi]\
395 modify exact [eax ebx edx esi]\
396
397 long dmulscale8(long i1, long i2, long i3, long i4);
398 #pragma aux dmulscale8 =\
399 "imul edx",\
400 "mov ebx, eax",\
401 "mov eax, esi",\
402 "mov esi, edx",\
403 "imul edi",\
404 "add eax, ebx",\
405 "adc edx, esi",\
406 "shrd eax, edx, 8",\
407 parm nomemory [eax][edx][esi][edi]\
408 modify exact [eax ebx edx esi]\
409
410 long dmulscale9(long i1, long i2, long i3, long i4);
411 #pragma aux dmulscale9 =\
412 "imul edx",\
413 "mov ebx, eax",\
414 "mov eax, esi",\
415 "mov esi, edx",\
416 "imul edi",\
417 "add eax, ebx",\
418 "adc edx, esi",\
419 "shrd eax, edx, 9",\
420 parm nomemory [eax][edx][esi][edi]\
421 modify exact [eax ebx edx esi]\
422
423 long dmulscale10(long i1, long i2, long i3, long i4);
424 #pragma aux dmulscale10 =\
425 "imul edx",\
426 "mov ebx, eax",\
427 "mov eax, esi",\
428 "mov esi, edx",\
429 "imul edi",\
430 "add eax, ebx",\
431 "adc edx, esi",\
432 "shrd eax, edx, 10",\
433 parm nomemory [eax][edx][esi][edi]\
434 modify exact [eax ebx edx esi]\
435
436 long dmulscale11(long i1, long i2, long i3, long i4);
437 #pragma aux dmulscale11 =\
438 "imul edx",\
439 "mov ebx, eax",\
440 "mov eax, esi",\
441 "mov esi, edx",\
442 "imul edi",\
443 "add eax, ebx",\
444 "adc edx, esi",\
445 "shrd eax, edx, 11",\
446 parm nomemory [eax][edx][esi][edi]\
447 modify exact [eax ebx edx esi]\
448
449 long dmulscale12(long i1, long i2, long i3, long i4);
450 #pragma aux dmulscale12 =\
451 "imul edx",\
452 "mov ebx, eax",\
453 "mov eax, esi",\
454 "mov esi, edx",\
455 "imul edi",\
456 "add eax, ebx",\
457 "adc edx, esi",\
458 "shrd eax, edx, 12",\
459 parm nomemory [eax][edx][esi][edi]\
460 modify exact [eax ebx edx esi]\
461
462 long dmulscale13(long i1, long i2, long i3, long i4);
463 #pragma aux dmulscale13 =\
464 "imul edx",\
465 "mov ebx, eax",\
466 "mov eax, esi",\
467 "mov esi, edx",\
468 "imul edi",\
469 "add eax, ebx",\
470 "adc edx, esi",\
471 "shrd eax, edx, 13",\
472 parm nomemory [eax][edx][esi][edi]\
473 modify exact [eax ebx edx esi]\
474
475 long dmulscale14(long i1, long i2, long i3, long i4);
476 #pragma aux dmulscale14 =\
477 "imul edx",\
478 "mov ebx, eax",\
479 "mov eax, esi",\
480 "mov esi, edx",\
481 "imul edi",\
482 "add eax, ebx",\
483 "adc edx, esi",\
484 "shrd eax, edx, 14",\
485 parm nomemory [eax][edx][esi][edi]\
486 modify exact [eax ebx edx esi]\
487
488 long dmulscale15(long i1, long i2, long i3, long i4);
489 #pragma aux dmulscale15 =\
490 "imul edx",\
491 "mov ebx, eax",\
492 "mov eax, esi",\
493 "mov esi, edx",\
494 "imul edi",\
495 "add eax, ebx",\
496 "adc edx, esi",\
497 "shrd eax, edx, 15",\
498 parm nomemory [eax][edx][esi][edi]\
499 modify exact [eax ebx edx esi]\
500
501 long dmulscale16(long i1, long i2, long i3, long i4);
502 #pragma aux dmulscale16 =\
503 "imul edx",\
504 "mov ebx, eax",\
505 "mov eax, esi",\
506 "mov esi, edx",\
507 "imul edi",\
508 "add eax, ebx",\
509 "adc edx, esi",\
510 "shrd eax, edx, 16",\
511 parm nomemory [eax][edx][esi][edi]\
512 modify exact [eax ebx edx esi]\
513
514 long dmulscale17(long i1, long i2, long i3, long i4);
515 #pragma aux dmulscale17 =\
516 "imul edx",\
517 "mov ebx, eax",\
518 "mov eax, esi",\
519 "mov esi, edx",\
520 "imul edi",\
521 "add eax, ebx",\
522 "adc edx, esi",\
523 "shrd eax, edx, 17",\
524 parm nomemory [eax][edx][esi][edi]\
525 modify exact [eax ebx edx esi]\
526
527 long dmulscale18(long i1, long i2, long i3, long i4);
528 #pragma aux dmulscale18 =\
529 "imul edx",\
530 "mov ebx, eax",\
531 "mov eax, esi",\
532 "mov esi, edx",\
533 "imul edi",\
534 "add eax, ebx",\
535 "adc edx, esi",\
536 "shrd eax, edx, 18",\
537 parm nomemory [eax][edx][esi][edi]\
538 modify exact [eax ebx edx esi]\
539
540 long dmulscale19(long i1, long i2, long i3, long i4);
541 #pragma aux dmulscale19 =\
542 "imul edx",\
543 "mov ebx, eax",\
544 "mov eax, esi",\
545 "mov esi, edx",\
546 "imul edi",\
547 "add eax, ebx",\
548 "adc edx, esi",\
549 "shrd eax, edx, 19",\
550 parm nomemory [eax][edx][esi][edi]\
551 modify exact [eax ebx edx esi]\
552
553 long dmulscale20(long i1, long i2, long i3, long i4);
554 #pragma aux dmulscale20 =\
555 "imul edx",\
556 "mov ebx, eax",\
557 "mov eax, esi",\
558 "mov esi, edx",\
559 "imul edi",\
560 "add eax, ebx",\
561 "adc edx, esi",\
562 "shrd eax, edx, 20",\
563 parm nomemory [eax][edx][esi][edi]\
564 modify exact [eax ebx edx esi]\
565
566 long dmulscale21(long i1, long i2, long i3, long i4);
567 #pragma aux dmulscale21 =\
568 "imul edx",\
569 "mov ebx, eax",\
570 "mov eax, esi",\
571 "mov esi, edx",\
572 "imul edi",\
573 "add eax, ebx",\
574 "adc edx, esi",\
575 "shrd eax, edx, 21",\
576 parm nomemory [eax][edx][esi][edi]\
577 modify exact [eax ebx edx esi]\
578
579 long dmulscale22(long i1, long i2, long i3, long i4);
580 #pragma aux dmulscale22 =\
581 "imul edx",\
582 "mov ebx, eax",\
583 "mov eax, esi",\
584 "mov esi, edx",\
585 "imul edi",\
586 "add eax, ebx",\
587 "adc edx, esi",\
588 "shrd eax, edx, 22",\
589 parm nomemory [eax][edx][esi][edi]\
590 modify exact [eax ebx edx esi]\
591
592 long dmulscale23(long i1, long i2, long i3, long i4);
593 #pragma aux dmulscale23 =\
594 "imul edx",\
595 "mov ebx, eax",\
596 "mov eax, esi",\
597 "mov esi, edx",\
598 "imul edi",\
599 "add eax, ebx",\
600 "adc edx, esi",\
601 "shrd eax, edx, 23",\
602 parm nomemory [eax][edx][esi][edi]\
603 modify exact [eax ebx edx esi]\
604
605 long dmulscale24(long i1, long i2, long i3, long i4);
606 #pragma aux dmulscale24 =\
607 "imul edx",\
608 "mov ebx, eax",\
609 "mov eax, esi",\
610 "mov esi, edx",\
611 "imul edi",\
612 "add eax, ebx",\
613 "adc edx, esi",\
614 "shrd eax, edx, 24",\
615 parm nomemory [eax][edx][esi][edi]\
616 modify exact [eax ebx edx esi]\
617
618 long dmulscale25(long i1, long i2, long i3, long i4);
619 #pragma aux dmulscale25 =\
620 "imul edx",\
621 "mov ebx, eax",\
622 "mov eax, esi",\
623 "mov esi, edx",\
624 "imul edi",\
625 "add eax, ebx",\
626 "adc edx, esi",\
627 "shrd eax, edx, 25",\
628 parm nomemory [eax][edx][esi][edi]\
629 modify exact [eax ebx edx esi]\
630
631 long dmulscale26(long i1, long i2, long i3, long i4);
632 #pragma aux dmulscale26 =\
633 "imul edx",\
634 "mov ebx, eax",\
635 "mov eax, esi",\
636 "mov esi, edx",\
637 "imul edi",\
638 "add eax, ebx",\
639 "adc edx, esi",\
640 "shrd eax, edx, 26",\
641 parm nomemory [eax][edx][esi][edi]\
642 modify exact [eax ebx edx esi]\
643
644 long dmulscale27(long i1, long i2, long i3, long i4);
645 #pragma aux dmulscale27 =\
646 "imul edx",\
647 "mov ebx, eax",\
648 "mov eax, esi",\
649 "mov esi, edx",\
650 "imul edi",\
651 "add eax, ebx",\
652 "adc edx, esi",\
653 "shrd eax, edx, 27",\
654 parm nomemory [eax][edx][esi][edi]\
655 modify exact [eax ebx edx esi]\
656
657 long dmulscale28(long i1, long i2, long i3, long i4);
658 #pragma aux dmulscale28 =\
659 "imul edx",\
660 "mov ebx, eax",\
661 "mov eax, esi",\
662 "mov esi, edx",\
663 "imul edi",\
664 "add eax, ebx",\
665 "adc edx, esi",\
666 "shrd eax, edx, 28",\
667 parm nomemory [eax][edx][esi][edi]\
668 modify exact [eax ebx edx esi]\
669
670 long dmulscale29(long i1, long i2, long i3, long i4);
671 #pragma aux dmulscale29 =\
672 "imul edx",\
673 "mov ebx, eax",\
674 "mov eax, esi",\
675 "mov esi, edx",\
676 "imul edi",\
677 "add eax, ebx",\
678 "adc edx, esi",\
679 "shrd eax, edx, 29",\
680 parm nomemory [eax][edx][esi][edi]\
681 modify exact [eax ebx edx esi]\
682
683 long dmulscale30(long i1, long i2, long i3, long i4);
684 #pragma aux dmulscale30 =\
685 "imul edx",\
686 "mov ebx, eax",\
687 "mov eax, esi",\
688 "mov esi, edx",\
689 "imul edi",\
690 "add eax, ebx",\
691 "adc edx, esi",\
692 "shrd eax, edx, 30",\
693 parm nomemory [eax][edx][esi][edi]\
694 modify exact [eax ebx edx esi]\
695
696 long dmulscale31(long i1, long i2, long i3, long i4);
697 #pragma aux dmulscale31 =\
698 "imul edx",\
699 "mov ebx, eax",\
700 "mov eax, esi",\
701 "mov esi, edx",\
702 "imul edi",\
703 "add eax, ebx",\
704 "adc edx, esi",\
705 "shrd eax, edx, 31",\
706 parm nomemory [eax][edx][esi][edi]\
707 modify exact [eax ebx edx esi]\
708
709 long dmulscale32(long i1, long i2, long i3, long i4);
710 #pragma aux dmulscale32 =\
711 "imul edx",\
712 "mov ebx, eax",\
713 "mov eax, esi",\
714 "mov esi, edx",\
715 "imul edi",\
716 "add eax, ebx",\
717 "adc edx, esi",\
718 parm nomemory [eax][edx][esi][edi]\
719 modify exact [eax ebx edx esi]\
720 value [edx]\
721
722 long tmulscale1(long i1, long i2, long i3, long i4, long i5, long i6);
723 #pragma aux tmulscale1 =\
724 "imul edx",\
725 "xchg eax, ebx",\
726 "xchg edx, ecx",\
727 "imul edx",\
728 "add ebx, eax",\
729 "adc ecx, edx",\
730 "mov eax, esi",\
731 "imul edi",\
732 "add eax, ebx",\
733 "adc edx, ecx",\
734 "shrd eax, edx, 1",\
735 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
736 modify exact [eax ebx ecx edx]\
737
738 long tmulscale2(long i1, long i2, long i3, long i4, long i5, long i6);
739 #pragma aux tmulscale2 =\
740 "imul edx",\
741 "xchg eax, ebx",\
742 "xchg edx, ecx",\
743 "imul edx",\
744 "add ebx, eax",\
745 "adc ecx, edx",\
746 "mov eax, esi",\
747 "imul edi",\
748 "add eax, ebx",\
749 "adc edx, ecx",\
750 "shrd eax, edx, 2",\
751 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
752 modify exact [eax ebx ecx edx]\
753
754 long tmulscale3(long i1, long i2, long i3, long i4, long i5, long i6);
755 #pragma aux tmulscale3 =\
756 "imul edx",\
757 "xchg eax, ebx",\
758 "xchg edx, ecx",\
759 "imul edx",\
760 "add ebx, eax",\
761 "adc ecx, edx",\
762 "mov eax, esi",\
763 "imul edi",\
764 "add eax, ebx",\
765 "adc edx, ecx",\
766 "shrd eax, edx, 3",\
767 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
768 modify exact [eax ebx ecx edx]\
769
770 long tmulscale4(long i1, long i2, long i3, long i4, long i5, long i6);
771 #pragma aux tmulscale4 =\
772 "imul edx",\
773 "xchg eax, ebx",\
774 "xchg edx, ecx",\
775 "imul edx",\
776 "add ebx, eax",\
777 "adc ecx, edx",\
778 "mov eax, esi",\
779 "imul edi",\
780 "add eax, ebx",\
781 "adc edx, ecx",\
782 "shrd eax, edx, 4",\
783 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
784 modify exact [eax ebx ecx edx]\
785
786 long tmulscale5(long i1, long i2, long i3, long i4, long i5, long i6);
787 #pragma aux tmulscale5 =\
788 "imul edx",\
789 "xchg eax, ebx",\
790 "xchg edx, ecx",\
791 "imul edx",\
792 "add ebx, eax",\
793 "adc ecx, edx",\
794 "mov eax, esi",\
795 "imul edi",\
796 "add eax, ebx",\
797 "adc edx, ecx",\
798 "shrd eax, edx, 5",\
799 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
800 modify exact [eax ebx ecx edx]\
801
802 long tmulscale6(long i1, long i2, long i3, long i4, long i5, long i6);
803 #pragma aux tmulscale6 =\
804 "imul edx",\
805 "xchg eax, ebx",\
806 "xchg edx, ecx",\
807 "imul edx",\
808 "add ebx, eax",\
809 "adc ecx, edx",\
810 "mov eax, esi",\
811 "imul edi",\
812 "add eax, ebx",\
813 "adc edx, ecx",\
814 "shrd eax, edx, 6",\
815 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
816 modify exact [eax ebx ecx edx]\
817
818 long tmulscale7(long i1, long i2, long i3, long i4, long i5, long i6);
819 #pragma aux tmulscale7 =\
820 "imul edx",\
821 "xchg eax, ebx",\
822 "xchg edx, ecx",\
823 "imul edx",\
824 "add ebx, eax",\
825 "adc ecx, edx",\
826 "mov eax, esi",\
827 "imul edi",\
828 "add eax, ebx",\
829 "adc edx, ecx",\
830 "shrd eax, edx, 7",\
831 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
832 modify exact [eax ebx ecx edx]\
833
834 long tmulscale8(long i1, long i2, long i3, long i4, long i5, long i6);
835 #pragma aux tmulscale8 =\
836 "imul edx",\
837 "xchg eax, ebx",\
838 "xchg edx, ecx",\
839 "imul edx",\
840 "add ebx, eax",\
841 "adc ecx, edx",\
842 "mov eax, esi",\
843 "imul edi",\
844 "add eax, ebx",\
845 "adc edx, ecx",\
846 "shrd eax, edx, 8",\
847 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
848 modify exact [eax ebx ecx edx]\
849
850 long tmulscale9(long i1, long i2, long i3, long i4, long i5, long i6);
851 #pragma aux tmulscale9 =\
852 "imul edx",\
853 "xchg eax, ebx",\
854 "xchg edx, ecx",\
855 "imul edx",\
856 "add ebx, eax",\
857 "adc ecx, edx",\
858 "mov eax, esi",\
859 "imul edi",\
860 "add eax, ebx",\
861 "adc edx, ecx",\
862 "shrd eax, edx, 9",\
863 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
864 modify exact [eax ebx ecx edx]\
865
866 long tmulscale10(long i1, long i2, long i3, long i4, long i5, long i6);
867 #pragma aux tmulscale10 =\
868 "imul edx",\
869 "xchg eax, ebx",\
870 "xchg edx, ecx",\
871 "imul edx",\
872 "add ebx, eax",\
873 "adc ecx, edx",\
874 "mov eax, esi",\
875 "imul edi",\
876 "add eax, ebx",\
877 "adc edx, ecx",\
878 "shrd eax, edx, 10",\
879 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
880 modify exact [eax ebx ecx edx]\
881
882 long tmulscale11(long i1, long i2, long i3, long i4, long i5, long i6);
883 #pragma aux tmulscale11 =\
884 "imul edx",\
885 "xchg eax, ebx",\
886 "xchg edx, ecx",\
887 "imul edx",\
888 "add ebx, eax",\
889 "adc ecx, edx",\
890 "mov eax, esi",\
891 "imul edi",\
892 "add eax, ebx",\
893 "adc edx, ecx",\
894 "shrd eax, edx, 11",\
895 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
896 modify exact [eax ebx ecx edx]\
897
898 long tmulscale12(long i1, long i2, long i3, long i4, long i5, long i6);
899 #pragma aux tmulscale12 =\
900 "imul edx",\
901 "xchg eax, ebx",\
902 "xchg edx, ecx",\
903 "imul edx",\
904 "add ebx, eax",\
905 "adc ecx, edx",\
906 "mov eax, esi",\
907 "imul edi",\
908 "add eax, ebx",\
909 "adc edx, ecx",\
910 "shrd eax, edx, 12",\
911 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
912 modify exact [eax ebx ecx edx]\
913
914 long tmulscale13(long i1, long i2, long i3, long i4, long i5, long i6);
915 #pragma aux tmulscale13 =\
916 "imul edx",\
917 "xchg eax, ebx",\
918 "xchg edx, ecx",\
919 "imul edx",\
920 "add ebx, eax",\
921 "adc ecx, edx",\
922 "mov eax, esi",\
923 "imul edi",\
924 "add eax, ebx",\
925 "adc edx, ecx",\
926 "shrd eax, edx, 13",\
927 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
928 modify exact [eax ebx ecx edx]\
929
930 long tmulscale14(long i1, long i2, long i3, long i4, long i5, long i6);
931 #pragma aux tmulscale14 =\
932 "imul edx",\
933 "xchg eax, ebx",\
934 "xchg edx, ecx",\
935 "imul edx",\
936 "add ebx, eax",\
937 "adc ecx, edx",\
938 "mov eax, esi",\
939 "imul edi",\
940 "add eax, ebx",\
941 "adc edx, ecx",\
942 "shrd eax, edx, 14",\
943 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
944 modify exact [eax ebx ecx edx]\
945
946 long tmulscale15(long i1, long i2, long i3, long i4, long i5, long i6);
947 #pragma aux tmulscale15 =\
948 "imul edx",\
949 "xchg eax, ebx",\
950 "xchg edx, ecx",\
951 "imul edx",\
952 "add ebx, eax",\
953 "adc ecx, edx",\
954 "mov eax, esi",\
955 "imul edi",\
956 "add eax, ebx",\
957 "adc edx, ecx",\
958 "shrd eax, edx, 15",\
959 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
960 modify exact [eax ebx ecx edx]\
961
962 long tmulscale16(long i1, long i2, long i3, long i4, long i5, long i6);
963 #pragma aux tmulscale16 =\
964 "imul edx",\
965 "xchg eax, ebx",\
966 "xchg edx, ecx",\
967 "imul edx",\
968 "add ebx, eax",\
969 "adc ecx, edx",\
970 "mov eax, esi",\
971 "imul edi",\
972 "add eax, ebx",\
973 "adc edx, ecx",\
974 "shrd eax, edx, 16",\
975 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
976 modify exact [eax ebx ecx edx]\
977
978 long tmulscale17(long i1, long i2, long i3, long i4, long i5, long i6);
979 #pragma aux tmulscale17 =\
980 "imul edx",\
981 "xchg eax, ebx",\
982 "xchg edx, ecx",\
983 "imul edx",\
984 "add ebx, eax",\
985 "adc ecx, edx",\
986 "mov eax, esi",\
987 "imul edi",\
988 "add eax, ebx",\
989 "adc edx, ecx",\
990 "shrd eax, edx, 17",\
991 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
992 modify exact [eax ebx ecx edx]\
993
994 long tmulscale18(long i1, long i2, long i3, long i4, long i5, long i6);
995 #pragma aux tmulscale18 =\
996 "imul edx",\
997 "xchg eax, ebx",\
998 "xchg edx, ecx",\
999 "imul edx",\
1000 "add ebx, eax",\
1001 "adc ecx, edx",\
1002 "mov eax, esi",\
1003 "imul edi",\
1004 "add eax, ebx",\
1005 "adc edx, ecx",\
1006 "shrd eax, edx, 18",\
1007 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1008 modify exact [eax ebx ecx edx]\
1009
1010 long tmulscale19(long i1, long i2, long i3, long i4, long i5, long i6);
1011 #pragma aux tmulscale19 =\
1012 "imul edx",\
1013 "xchg eax, ebx",\
1014 "xchg edx, ecx",\
1015 "imul edx",\
1016 "add ebx, eax",\
1017 "adc ecx, edx",\
1018 "mov eax, esi",\
1019 "imul edi",\
1020 "add eax, ebx",\
1021 "adc edx, ecx",\
1022 "shrd eax, edx, 19",\
1023 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1024 modify exact [eax ebx ecx edx]\
1025
1026 long tmulscale20(long i1, long i2, long i3, long i4, long i5, long i6);
1027 #pragma aux tmulscale20 =\
1028 "imul edx",\
1029 "xchg eax, ebx",\
1030 "xchg edx, ecx",\
1031 "imul edx",\
1032 "add ebx, eax",\
1033 "adc ecx, edx",\
1034 "mov eax, esi",\
1035 "imul edi",\
1036 "add eax, ebx",\
1037 "adc edx, ecx",\
1038 "shrd eax, edx, 20",\
1039 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1040 modify exact [eax ebx ecx edx]\
1041
1042 long tmulscale21(long i1, long i2, long i3, long i4, long i5, long i6);
1043 #pragma aux tmulscale21 =\
1044 "imul edx",\
1045 "xchg eax, ebx",\
1046 "xchg edx, ecx",\
1047 "imul edx",\
1048 "add ebx, eax",\
1049 "adc ecx, edx",\
1050 "mov eax, esi",\
1051 "imul edi",\
1052 "add eax, ebx",\
1053 "adc edx, ecx",\
1054 "shrd eax, edx, 21",\
1055 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1056 modify exact [eax ebx ecx edx]\
1057
1058 long tmulscale22(long i1, long i2, long i3, long i4, long i5, long i6);
1059 #pragma aux tmulscale22 =\
1060 "imul edx",\
1061 "xchg eax, ebx",\
1062 "xchg edx, ecx",\
1063 "imul edx",\
1064 "add ebx, eax",\
1065 "adc ecx, edx",\
1066 "mov eax, esi",\
1067 "imul edi",\
1068 "add eax, ebx",\
1069 "adc edx, ecx",\
1070 "shrd eax, edx, 22",\
1071 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1072 modify exact [eax ebx ecx edx]\
1073
1074 long tmulscale23(long i1, long i2, long i3, long i4, long i5, long i6);
1075 #pragma aux tmulscale23 =\
1076 "imul edx",\
1077 "xchg eax, ebx",\
1078 "xchg edx, ecx",\
1079 "imul edx",\
1080 "add ebx, eax",\
1081 "adc ecx, edx",\
1082 "mov eax, esi",\
1083 "imul edi",\
1084 "add eax, ebx",\
1085 "adc edx, ecx",\
1086 "shrd eax, edx, 23",\
1087 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1088 modify exact [eax ebx ecx edx]\
1089
1090 long tmulscale24(long i1, long i2, long i3, long i4, long i5, long i6);
1091 #pragma aux tmulscale24 =\
1092 "imul edx",\
1093 "xchg eax, ebx",\
1094 "xchg edx, ecx",\
1095 "imul edx",\
1096 "add ebx, eax",\
1097 "adc ecx, edx",\
1098 "mov eax, esi",\
1099 "imul edi",\
1100 "add eax, ebx",\
1101 "adc edx, ecx",\
1102 "shrd eax, edx, 24",\
1103 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1104 modify exact [eax ebx ecx edx]\
1105
1106 long tmulscale25(long i1, long i2, long i3, long i4, long i5, long i6);
1107 #pragma aux tmulscale25 =\
1108 "imul edx",\
1109 "xchg eax, ebx",\
1110 "xchg edx, ecx",\
1111 "imul edx",\
1112 "add ebx, eax",\
1113 "adc ecx, edx",\
1114 "mov eax, esi",\
1115 "imul edi",\
1116 "add eax, ebx",\
1117 "adc edx, ecx",\
1118 "shrd eax, edx, 25",\
1119 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1120 modify exact [eax ebx ecx edx]\
1121
1122 long tmulscale26(long i1, long i2, long i3, long i4, long i5, long i6);
1123 #pragma aux tmulscale26 =\
1124 "imul edx",\
1125 "xchg eax, ebx",\
1126 "xchg edx, ecx",\
1127 "imul edx",\
1128 "add ebx, eax",\
1129 "adc ecx, edx",\
1130 "mov eax, esi",\
1131 "imul edi",\
1132 "add eax, ebx",\
1133 "adc edx, ecx",\
1134 "shrd eax, edx, 26",\
1135 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1136 modify exact [eax ebx ecx edx]\
1137
1138 long tmulscale27(long i1, long i2, long i3, long i4, long i5, long i6);
1139 #pragma aux tmulscale27 =\
1140 "imul edx",\
1141 "xchg eax, ebx",\
1142 "xchg edx, ecx",\
1143 "imul edx",\
1144 "add ebx, eax",\
1145 "adc ecx, edx",\
1146 "mov eax, esi",\
1147 "imul edi",\
1148 "add eax, ebx",\
1149 "adc edx, ecx",\
1150 "shrd eax, edx, 27",\
1151 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1152 modify exact [eax ebx ecx edx]\
1153
1154 long tmulscale28(long i1, long i2, long i3, long i4, long i5, long i6);
1155 #pragma aux tmulscale28 =\
1156 "imul edx",\
1157 "xchg eax, ebx",\
1158 "xchg edx, ecx",\
1159 "imul edx",\
1160 "add ebx, eax",\
1161 "adc ecx, edx",\
1162 "mov eax, esi",\
1163 "imul edi",\
1164 "add eax, ebx",\
1165 "adc edx, ecx",\
1166 "shrd eax, edx, 28",\
1167 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1168 modify exact [eax ebx ecx edx]\
1169
1170 long tmulscale29(long i1, long i2, long i3, long i4, long i5, long i6);
1171 #pragma aux tmulscale29 =\
1172 "imul edx",\
1173 "xchg eax, ebx",\
1174 "xchg edx, ecx",\
1175 "imul edx",\
1176 "add ebx, eax",\
1177 "adc ecx, edx",\
1178 "mov eax, esi",\
1179 "imul edi",\
1180 "add eax, ebx",\
1181 "adc edx, ecx",\
1182 "shrd eax, edx, 29",\
1183 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1184 modify exact [eax ebx ecx edx]\
1185
1186 long tmulscale30(long i1, long i2, long i3, long i4, long i5, long i6);
1187 #pragma aux tmulscale30 =\
1188 "imul edx",\
1189 "xchg eax, ebx",\
1190 "xchg edx, ecx",\
1191 "imul edx",\
1192 "add ebx, eax",\
1193 "adc ecx, edx",\
1194 "mov eax, esi",\
1195 "imul edi",\
1196 "add eax, ebx",\
1197 "adc edx, ecx",\
1198 "shrd eax, edx, 30",\
1199 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1200 modify exact [eax ebx ecx edx]\
1201
1202 long tmulscale31(long i1, long i2, long i3, long i4, long i5, long i6);
1203 #pragma aux tmulscale31 =\
1204 "imul edx",\
1205 "xchg eax, ebx",\
1206 "xchg edx, ecx",\
1207 "imul edx",\
1208 "add ebx, eax",\
1209 "adc ecx, edx",\
1210 "mov eax, esi",\
1211 "imul edi",\
1212 "add eax, ebx",\
1213 "adc edx, ecx",\
1214 "shrd eax, edx, 31",\
1215 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1216 modify exact [eax ebx ecx edx]\
1217
1218 long tmulscale32(long i1, long i2, long i3, long i4, long i5, long i6);
1219 #pragma aux tmulscale32 =\
1220 "imul edx",\
1221 "xchg eax, ebx",\
1222 "xchg edx, ecx",\
1223 "imul edx",\
1224 "add ebx, eax",\
1225 "adc ecx, edx",\
1226 "mov eax, esi",\
1227 "imul edi",\
1228 "add eax, ebx",\
1229 "adc edx, ecx",\
1230 parm nomemory [eax][edx][ebx][ecx][esi][edi]\
1231 modify exact [eax ebx ecx edx]\
1232 value [edx]\
1233
1234 long boundmulscale(long i1, long i2, long i3);
1235 #pragma aux boundmulscale =\
1236 "imul ebx",\
1237 "mov ebx, edx",\
1238 "shrd eax, edx, cl",\
1239 "sar edx, cl",\
1240 "xor edx, eax",\
1241 "js checkit",\
1242 "xor edx, eax",\
1243 "jz skipboundit",\
1244 "cmp edx, 0xffffffff",\
1245 "je skipboundit",\
1246 "checkit:",\
1247 "mov eax, ebx",\
1248 "sar eax, 31",\
1249 "xor eax, 0x7fffffff",\
1250 "skipboundit:",\
1251 parm nomemory [eax][ebx][ecx]\
1252 modify exact [eax ebx edx]\
1253
1254 long divscale(long i1, long i2, long i3);
1255 #pragma aux divscale =\
1256 "mov edx, eax",\
1257 "shl eax, cl",\
1258 "neg cl",\
1259 "sar edx, cl",\
1260 "idiv ebx",\
1261 parm nomemory [eax][ebx][ecx]\
1262 modify exact [eax ecx edx]\
1263
1264 long divscale1(long i1, long i2);
1265 #pragma aux divscale1 =\
1266 "add eax, eax",\
1267 "sbb edx, edx",\
1268 "idiv ebx",\
1269 parm nomemory [eax][ebx]\
1270 modify exact [eax edx]\
1271
1272 long divscale2(long i1, long i2);
1273 #pragma aux divscale2 =\
1274 "mov edx, eax",\
1275 "sar edx, 30",\
1276 "lea eax, [eax*4]",\
1277 "idiv ebx",\
1278 parm nomemory [eax][ebx]\
1279 modify exact [eax edx]\
1280
1281 long divscale3(long i1, long i2);
1282 #pragma aux divscale3 =\
1283 "mov edx, eax",\
1284 "sar edx, 29",\
1285 "lea eax, [eax*8]",\
1286 "idiv ebx",\
1287 parm nomemory [eax][ebx]\
1288 modify exact [eax edx]\
1289
1290 long divscale4(long i1, long i2);
1291 #pragma aux divscale4 =\
1292 "mov edx, eax",\
1293 "sar edx, 28",\
1294 "shl eax, 4",\
1295 "idiv ebx",\
1296 parm nomemory [eax][ebx]\
1297 modify exact [eax edx]\
1298
1299 long divscale5(long i1, long i2);
1300 #pragma aux divscale5 =\
1301 "mov edx, eax",\
1302 "sar edx, 27",\
1303 "shl eax, 5",\
1304 "idiv ebx",\
1305 parm nomemory [eax][ebx]\
1306 modify exact [eax edx]\
1307
1308 long divscale6(long i1, long i2);
1309 #pragma aux divscale6 =\
1310 "mov edx, eax",\
1311 "sar edx, 26",\
1312 "shl eax, 6",\
1313 "idiv ebx",\
1314 parm nomemory [eax][ebx]\
1315 modify exact [eax edx]\
1316
1317 long divscale7(long i1, long i2);
1318 #pragma aux divscale7 =\
1319 "mov edx, eax",\
1320 "sar edx, 25",\
1321 "shl eax, 7",\
1322 "idiv ebx",\
1323 parm nomemory [eax][ebx]\
1324 modify exact [eax edx]\
1325
1326 long divscale8(long i1, long i2);
1327 #pragma aux divscale8 =\
1328 "mov edx, eax",\
1329 "sar edx, 24",\
1330 "shl eax, 8",\
1331 "idiv ebx",\
1332 parm nomemory [eax][ebx]\
1333 modify exact [eax edx]\
1334
1335 long divscale9(long i1, long i2);
1336 #pragma aux divscale9 =\
1337 "mov edx, eax",\
1338 "sar edx, 23",\
1339 "shl eax, 9",\
1340 "idiv ebx",\
1341 parm nomemory [eax][ebx]\
1342 modify exact [eax edx]\
1343
1344 long divscale10(long i1, long i2);
1345 #pragma aux divscale10 =\
1346 "mov edx, eax",\
1347 "sar edx, 22",\
1348 "shl eax, 10",\
1349 "idiv ebx",\
1350 parm nomemory [eax][ebx]\
1351 modify exact [eax edx]\
1352
1353 long divscale11(long i1, long i2);
1354 #pragma aux divscale11 =\
1355 "mov edx, eax",\
1356 "sar edx, 21",\
1357 "shl eax, 11",\
1358 "idiv ebx",\
1359 parm nomemory [eax][ebx]\
1360 modify exact [eax edx]\
1361
1362 long divscale12(long i1, long i2);
1363 #pragma aux divscale12 =\
1364 "mov edx, eax",\
1365 "sar edx, 20",\
1366 "shl eax, 12",\
1367 "idiv ebx",\
1368 parm nomemory [eax][ebx]\
1369 modify exact [eax edx]\
1370
1371 long divscale13(long i1, long i2);
1372 #pragma aux divscale13 =\
1373 "mov edx, eax",\
1374 "sar edx, 19",\
1375 "shl eax, 13",\
1376 "idiv ebx",\
1377 parm nomemory [eax][ebx]\
1378 modify exact [eax edx]\
1379
1380 long divscale14(long i1, long i2);
1381 #pragma aux divscale14 =\
1382 "mov edx, eax",\
1383 "sar edx, 18",\
1384 "shl eax, 14",\
1385 "idiv ebx",\
1386 parm nomemory [eax][ebx]\
1387 modify exact [eax edx]\
1388
1389 long divscale15(long i1, long i2);
1390 #pragma aux divscale15 =\
1391 "mov edx, eax",\
1392 "sar edx, 17",\
1393 "shl eax, 15",\
1394 "idiv ebx",\
1395 parm nomemory [eax][ebx]\
1396 modify exact [eax edx]\
1397
1398 long divscale16(long i1, long i2);
1399 #pragma aux divscale16 =\
1400 "mov edx, eax",\
1401 "sar edx, 16",\
1402 "shl eax, 16",\
1403 "idiv ebx",\
1404 parm nomemory [eax][ebx]\
1405 modify exact [eax edx]\
1406
1407 long divscale17(long i1, long i2);
1408 #pragma aux divscale17 =\
1409 "mov edx, eax",\
1410 "sar edx, 15",\
1411 "shl eax, 17",\
1412 "idiv ebx",\
1413 parm nomemory [eax][ebx]\
1414 modify exact [eax edx]\
1415
1416 long divscale18(long i1, long i2);
1417 #pragma aux divscale18 =\
1418 "mov edx, eax",\
1419 "sar edx, 14",\
1420 "shl eax, 18",\
1421 "idiv ebx",\
1422 parm nomemory [eax][ebx]\
1423 modify exact [eax edx]\
1424
1425 long divscale19(long i1, long i2);
1426 #pragma aux divscale19 =\
1427 "mov edx, eax",\
1428 "sar edx, 13",\
1429 "shl eax, 19",\
1430 "idiv ebx",\
1431 parm nomemory [eax][ebx]\
1432 modify exact [eax edx]\
1433
1434 long divscale20(long i1, long i2);
1435 #pragma aux divscale20 =\
1436 "mov edx, eax",\
1437 "sar edx, 12",\
1438 "shl eax, 20",\
1439 "idiv ebx",\
1440 parm nomemory [eax][ebx]\
1441 modify exact [eax edx]\
1442
1443 long divscale21(long i1, long i2);
1444 #pragma aux divscale21 =\
1445 "mov edx, eax",\
1446 "sar edx, 11",\
1447 "shl eax, 21",\
1448 "idiv ebx",\
1449 parm nomemory [eax][ebx]\
1450 modify exact [eax edx]\
1451
1452 long divscale22(long i1, long i2);
1453 #pragma aux divscale22 =\
1454 "mov edx, eax",\
1455 "sar edx, 10",\
1456 "shl eax, 22",\
1457 "idiv ebx",\
1458 parm nomemory [eax][ebx]\
1459 modify exact [eax edx]\
1460
1461 long divscale23(long i1, long i2);
1462 #pragma aux divscale23 =\
1463 "mov edx, eax",\
1464 "sar edx, 9",\
1465 "shl eax, 23",\
1466 "idiv ebx",\
1467 parm nomemory [eax][ebx]\
1468 modify exact [eax edx]\
1469
1470 long divscale24(long i1, long i2);
1471 #pragma aux divscale24 =\
1472 "mov edx, eax",\
1473 "sar edx, 8",\
1474 "shl eax, 24",\
1475 "idiv ebx",\
1476 parm nomemory [eax][ebx]\
1477 modify exact [eax edx]\
1478
1479 long divscale25(long i1, long i2);
1480 #pragma aux divscale25 =\
1481 "mov edx, eax",\
1482 "sar edx, 7",\
1483 "shl eax, 25",\
1484 "idiv ebx",\
1485 parm nomemory [eax][ebx]\
1486 modify exact [eax edx]\
1487
1488 long divscale26(long i1, long i2);
1489 #pragma aux divscale26 =\
1490 "mov edx, eax",\
1491 "sar edx, 6",\
1492 "shl eax, 26",\
1493 "idiv ebx",\
1494 parm nomemory [eax][ebx]\
1495 modify exact [eax edx]\
1496
1497 long divscale27(long i1, long i2);
1498 #pragma aux divscale27 =\
1499 "mov edx, eax",\
1500 "sar edx, 5",\
1501 "shl eax, 27",\
1502 "idiv ebx",\
1503 parm nomemory [eax][ebx]\
1504 modify exact [eax edx]\
1505
1506 long divscale28(long i1, long i2);
1507 #pragma aux divscale28 =\
1508 "mov edx, eax",\
1509 "sar edx, 4",\
1510 "shl eax, 28",\
1511 "idiv ebx",\
1512 parm nomemory [eax][ebx]\
1513 modify exact [eax edx]\
1514
1515 long divscale29(long i1, long i2);
1516 #pragma aux divscale29 =\
1517 "mov edx, eax",\
1518 "sar edx, 3",\
1519 "shl eax, 29",\
1520 "idiv ebx",\
1521 parm nomemory [eax][ebx]\
1522 modify exact [eax edx]\
1523
1524 long divscale30(long i1, long i2);
1525 #pragma aux divscale30 =\
1526 "mov edx, eax",\
1527 "sar edx, 2",\
1528 "shl eax, 30",\
1529 "idiv ebx",\
1530 parm nomemory [eax][ebx]\
1531 modify exact [eax edx]\
1532
1533 long divscale31(long i1, long i2);
1534 #pragma aux divscale31 =\
1535 "mov edx, eax",\
1536 "sar edx, 1",\
1537 "shl eax, 31",\
1538 "idiv ebx",\
1539 parm nomemory [eax][ebx]\
1540 modify exact [eax edx]\
1541
1542 long divscale32(long i1, long i2);
1543 #pragma aux divscale32 =\
1544 "xor eax, eax",\
1545 "idiv ebx",\
1546 parm nomemory [edx][ebx]\
1547 modify exact [eax edx]\
1548
1549 /* !!! move these into ves.h? --ryan. */
1550 #ifdef PLATFORM_DOS
1551
1552 void int5(void);
1553 #pragma aux int5 =\
1554 "int 0x5",\
1555
1556 int setupmouse(void);
1557 #pragma aux setupmouse =\
1558 "mov ax, 0",\
1559 "int 33h",\
1560 "and eax, 0x0000ffff",\
1561 modify exact [eax]\
1562
1563 void readmousexy(short *x, short *y);
1564 #pragma aux readmousexy =\
1565 "mov ax, 11d",\
1566 "int 33h",\
1567 "mov [esi], cx",\
1568 "mov [edi], dx",\
1569 parm [esi][edi]\
1570 modify exact [eax ebx ecx edx]\
1571
1572 void readmousebstatus(short *buttons);
1573 #pragma aux readmousebstatus =\
1574 "mov ax, 5d",\
1575 "int 33h",\
1576 "mov [esi], ax",\
1577 parm [esi]\
1578 modify exact [eax ebx ecx edx]\
1579
1580 unsigned char readpixel(long offset);
1581 #pragma aux readpixel =\
1582 "mov al, byte ptr [edi]",\
1583 parm nomemory [edi]\
1584 modify exact [eax]\
1585
1586 void drawpixel(long offset, unsigned char p);
1587 #pragma aux drawpixel =\
1588 "mov byte ptr [edi], al",\
1589 parm [edi][eax]\
1590 modify exact \
1591
1592 void drawpixels(long offset, unsigned short p);
1593 #pragma aux drawpixels =\
1594 "mov word ptr [edi], ax",\
1595 parm [edi][eax]\
1596 modify exact \
1597
1598 void drawpixelses(long offset, unsigned long p);
1599 #pragma aux drawpixelses =\
1600 "mov dword ptr [edi], eax",\
1601 parm [edi][eax]\
1602 modify exact \
1603
1604 #endif
1605
1606
1607 void clearbuf(void *buf, long i2, long i3);
1608 #pragma aux clearbuf =\
1609 "rep stosd",\
1610 parm [edi][ecx][eax]\
1611 modify exact [edi ecx]\
1612
1613 void clearbufbyte(void *buf, long i2, long i3);
1614 #pragma aux clearbufbyte =\
1615 "cmp ecx, 4",\
1616 "jae longcopy",\
1617 "test cl, 1",\
1618 "jz preskip",\
1619 "stosb",\
1620 "preskip: shr ecx, 1",\
1621 "rep stosw",\
1622 "jmp endit",\
1623 "longcopy: test edi, 1",\
1624 "jz skip1",\
1625 "stosb",\
1626 "dec ecx",\
1627 "skip1: test edi, 2",\
1628 "jz skip2",\
1629 "stosw",\
1630 "sub ecx, 2",\
1631 "skip2: mov ebx, ecx",\
1632 "shr ecx, 2",\
1633 "rep stosd",\
1634 "test bl, 2",\
1635 "jz skip3",\
1636 "stosw",\
1637 "skip3: test bl, 1",\
1638 "jz endit",\
1639 "stosb",\
1640 "endit:",\
1641 parm [edi][ecx][eax]\
1642 modify [ebx]\
1643
1644 void copybuf(void *src, void *dst, long len);
1645 #pragma aux copybuf =\
1646 "rep movsd",\
1647 parm [esi][edi][ecx]\
1648 modify exact [ecx esi edi]\
1649
1650 void copybufbyte(void *src, void *dst, long len);
1651 #pragma aux copybufbyte =\
1652 "cmp ecx, 4",\
1653 "jae longcopy",\
1654 "test cl, 1",\
1655 "jz preskip",\
1656 "movsb",\
1657 "preskip: shr ecx, 1",\
1658 "rep movsw",\
1659 "jmp endit",\
1660 "longcopy: test edi, 1",\
1661 "jz skip1",\
1662 "movsb",\
1663 "dec ecx",\
1664 "skip1: test edi, 2",\
1665 "jz skip2",\
1666 "movsw",\
1667 "sub ecx, 2",\
1668 "skip2: mov ebx, ecx",\
1669 "shr ecx, 2",\
1670 "rep movsd",\
1671 "test bl, 2",\
1672 "jz skip3",\
1673 "movsw",\
1674 "skip3: test bl, 1",\
1675 "jz endit",\
1676 "movsb",\
1677 "endit:",\
1678 parm [esi][edi][ecx]\
1679 modify [ebx]\
1680
1681 void copybufreverse(void *src, void *dst, long len);
1682 #pragma aux copybufreverse =\
1683 "shr ecx, 1",\
1684 "jnc skipit1",\
1685 "mov al, byte ptr [esi]",\
1686 "dec esi",\
1687 "mov byte ptr [edi], al",\
1688 "inc edi",\
1689 "skipit1: shr ecx, 1",\
1690 "jnc skipit2",\
1691 "mov ax, word ptr [esi-1]",\
1692 "sub esi, 2",\
1693 "ror ax, 8",\
1694 "mov word ptr [edi], ax",\
1695 "add edi, 2",\
1696 "skipit2: test ecx, ecx",\
1697 "jz endloop",\
1698 "begloop: mov eax, dword ptr [esi-3]",\
1699 "sub esi, 4",\
1700 "bswap eax",\
1701 "mov dword ptr [edi], eax",\
1702 "add edi, 4",\
1703 "dec ecx",\
1704 "jnz begloop",\
1705 "endloop:",\
1706 parm [esi][edi][ecx]\
1707
1708 void qinterpolatedown16(long *i1, long i2, long i3, long i4);
1709 #pragma aux qinterpolatedown16 =\
1710 "mov ebx, ecx",\
1711 "shr ecx, 1",\
1712 "jz skipbegcalc",\
1713 "begqcalc: lea edi, [edx+esi]",\
1714 "sar edx, 16",\
1715 "mov dword ptr [eax], edx",\
1716 "lea edx, [edi+esi]",\
1717 "sar edi, 16",\
1718 "mov dword ptr [eax+4], edi",\
1719 "add eax, 8",\
1720 "dec ecx",\
1721 "jnz begqcalc",\
1722 "test ebx, 1",\
1723 "jz skipbegqcalc2",\
1724 "skipbegcalc: sar edx, 16",\
1725 "mov dword ptr [eax], edx",\
1726 "skipbegqcalc2:",\
1727 parm [eax][ecx][edx][esi]\
1728 modify exact [eax ebx ecx edx edi]\
1729
1730 void qinterpolatedown16short(long *i1, long i2, long i3, long i4);
1731 #pragma aux qinterpolatedown16short =\
1732 "test ecx, ecx",\
1733 "jz endit",\
1734 "test al, 2",\
1735 "jz skipalignit",\
1736 "mov ebx, edx",\
1737 "sar ebx, 16",\
1738 "mov word ptr [eax], bx",\
1739 "add edx, esi",\
1740 "add eax, 2",\
1741 "dec ecx",\
1742 "jz endit",\
1743 "skipalignit: sub ecx, 2",\
1744 "jc finishit",\
1745 "begqcalc: mov ebx, edx",\
1746 "add edx, esi",\
1747 "sar ebx, 16",\
1748 "mov edi, edx",\
1749 "and edi, 0ffff0000h",\
1750 "add edx, esi",\
1751 "add ebx, edi",\
1752 "mov dword ptr [eax], ebx",\
1753 "add eax, 4",\
1754 "sub ecx, 2",\
1755 "jnc begqcalc",\
1756 "test cl, 1",\
1757 "jz endit",\
1758 "finishit: mov ebx, edx",\
1759 "sar ebx, 16",\
1760 "mov word ptr [eax], bx",\
1761 "endit:",\
1762 parm [eax][ecx][edx][esi]\
1763 modify exact [eax ebx ecx edx edi]\
1764
1765
1766 #if (defined PLATFORM_DOS) /* !!! move this to dos_driver.c? */
1767
1768 void setcolor16(int i1);
1769 #pragma aux setcolor16 =\
1770 "mov dx, 0x3ce",\
1771 "shl ax, 8",\
1772 "out dx, ax",\
1773 parm [eax]\
1774 modify exact [eax edx]\
1775
1776 #endif /* defined PLATFORM_DOS */
1777
1778
1779 void vlin16first(long i1, long i2);
1780 #pragma aux vlin16first =\
1781 "mov al, byte ptr [edi]",\
1782 "mov eax, ecx",\
1783 "shr ecx, 2",\
1784 "begvlin16firsta: mov byte ptr [edi], al",\
1785 "mov byte ptr [edi+80], al",\
1786 "mov byte ptr [edi+160], al",\
1787 "mov byte ptr [edi+240], al",\
1788 "add edi, 320",\
1789 "dec ecx",\
1790 "jnz begvlin16firsta",\
1791 "mov ecx, eax",\
1792 "and ecx, 3",\
1793 "jz skipfirst",\
1794 "begvlin16firstb: mov byte ptr [edi], al",\
1795 "add edi, 80",\
1796 "dec ecx",\
1797 "jnz begvlin16firstb",\
1798 "skipfirst:",\
1799 parm [edi][ecx]\
1800 modify exact [eax ecx edi]\
1801
1802 void vlin16(long i1, long i2);
1803 #pragma aux vlin16 =\
1804 "mov esi, edi",\
1805 "begvlin16: movsb",\
1806 "add edi, 79",\
1807 "add esi, 79",\
1808 "dec ecx",\
1809 "jnz begvlin16",\
1810 parm [edi][ecx]\
1811 modify exact [ecx esi edi]\
1812
1813 #if (defined PLATFORM_DOS) /* !!! move this to dos_driver.c? */
1814
1815 void drawpixel16(long offset);
1816 #pragma aux drawpixel16 =\
1817 "mov ecx, edi",\
1818 "mov eax, 0x00008008",\
1819 "mov dx, 0x3ce",\
1820 "ror ah, cl",\
1821 "shr edi, 3",\
1822 "out dx, ax",\
1823 "mov cl, byte ptr [edi+0xa0000]",\
1824 "mov byte ptr [edi+0xa0000], al",\
1825 parm [edi]\
1826 modify exact [eax ecx edx edi]\
1827
1828 void fillscreen16(long i1, long i2, long i3);
1829 #pragma aux fillscreen16 =\
1830 "mov dx, 0x3ce",\
1831 "shl ax, 8",\
1832 "out dx, ax",\
1833 "mov ax, 0xff08",\
1834 "out dx, ax",\
1835 "shr ecx, 5",\
1836 "add edi, 0xa0000",\
1837 "rep stosd",\
1838 parm [edi][eax][ecx]\
1839 modify exact [eax ecx edx edi]\
1840
1841 void koutp(long i1, long i);
1842 #pragma aux koutp =\
1843 "out dx, al",\
1844 parm [edx][eax]\
1845 modify exact \
1846
1847 void koutpw(long i1, long i);
1848 #pragma aux koutpw =\
1849 "out dx, ax",\
1850 parm [edx][eax]\
1851 modify exact \
1852
1853 int kinp(long i);
1854 #pragma aux kinp =\
1855 "in al, dx",\
1856 parm nomemory [edx]\
1857 modify exact [eax]\
1858
1859 #endif /* defined PLATFORM_DOS */
1860
1861
1862 long mul3(long i1);
1863 #pragma aux mul3 =\
1864 "lea eax, [eax+eax*2]",\
1865 parm nomemory [eax]\
1866
1867 long mul5(long i1);
1868 #pragma aux mul5 =\
1869 "lea eax, [eax+eax*4]",\
1870 parm nomemory [eax]\
1871
1872 long mul9(long i1);
1873 #pragma aux mul9 =\
1874 "lea eax, [eax+eax*8]",\
1875 parm nomemory [eax]\
1876
1877 /* returns eax/ebx, dmval = eax%edx; */
1878 long divmod(long i1, long i2);
1879 #pragma aux divmod =\
1880 "xor edx, edx",\
1881 "div ebx",\
1882 "mov dmval, edx",\
1883 parm [eax][ebx]\
1884 modify exact [eax edx]\
1885 value [eax]
1886
1887 /* returns eax%ebx, dmval = eax/edx; */
1888 long moddiv(long i1, long i2);
1889 #pragma aux moddiv =\
1890 "xor edx, edx",\
1891 "div ebx",\
1892 "mov dmval, eax",\
1893 parm [eax][ebx]\
1894 modify exact [eax edx]\
1895 value [edx]
1896
1897 long klabs(long i1);
1898 #pragma aux klabs =\
1899 "test eax, eax",\
1900 "jns skipnegate",\
1901 "neg eax",\
1902 "skipnegate:",\
1903 parm nomemory [eax]\
1904
1905 long ksgn(long i1);
1906 #pragma aux ksgn =\
1907 "add ebx, ebx",\
1908 "sbb eax, eax",\
1909 "cmp eax, ebx",\
1910 "adc al, 0",\
1911 parm nomemory [ebx]\
1912 modify exact [eax ebx]\
1913
1914 /* eax = (unsigned min)umin(eax,ebx) */
1915 long umin(long i1, long i2);
1916 #pragma aux umin =\
1917 "sub eax, ebx",\
1918 "sbb ecx, ecx",\
1919 "and eax, ecx",\
1920 "add eax, ebx",\
1921 parm nomemory [eax][ebx]\
1922 modify exact [eax ecx]\
1923
1924 /* eax = (unsigned max)umax(eax,ebx) */
1925 long umax(long i1, long i2);
1926 #pragma aux umax =\
1927 "sub eax, ebx",\
1928 "sbb ecx, ecx",\
1929 "xor ecx, 0xffffffff",\
1930 "and eax, ecx",\
1931 "add eax, ebx",\
1932 parm nomemory [eax][ebx]\
1933 modify exact [eax ecx]\
1934
1935 long kmin(long i1, long i2);
1936 #pragma aux kmin =\
1937 "cmp eax, ebx",\
1938 "jl skipit",\
1939 "mov eax, ebx",\
1940 "skipit:",\
1941 parm nomemory [eax][ebx]\
1942 modify exact [eax]\
1943
1944 long kmax(long i1, long i2);
1945 #pragma aux kmax =\
1946 "cmp eax, ebx",\
1947 "jg skipit",\
1948 "mov eax, ebx",\
1949 "skipit:",\
1950 parm nomemory [eax][ebx]\
1951 modify exact [eax]\
1952
1953 #if (defined PLATFORM_DOS) /* !!! move to dos_driver.c? */
1954 void limitrate(void);
1955 #pragma aux limitrate =\
1956 "mov dx, 0x3da",\
1957 "wait1: in al, dx",\
1958 "test al, 8",\
1959 "jnz wait1",\
1960 "wait2: in al, dx",\
1961 "test al, 8",\
1962 "jz wait2",\
1963 modify exact [eax edx]\
1964
1965 long readtimer(void);
1966 #pragma aux readtimer =\
1967 "mov al, 0xd2",\
1968 "out 0x43, al",\
1969 "in al, 0x40",\
1970 "shl eax, 24",\
1971 "in al, 0x40",\
1972 "rol eax, 8",\
1973 modify [eax]\
1974
1975 void redblueblit(void *i1, void *i2, long i3);
1976 #pragma aux redblueblit = \
1977 "xor ecx, ecx",\
1978 "begblit: mov eax, dword ptr [edx+ecx]",\
1979 "shl eax, 4",\
1980 "add eax, dword ptr [ebx+ecx]",\
1981 "mov dword ptr [ecx+0xa0000], eax",\
1982 "add ecx, 4",\
1983 "cmp ecx, esi",\
1984 "jb begblit",\
1985 parm [ebx][edx][esi]\
1986 modify exact [eax ecx]\
1987
1988 #pragma aux chainblit =\
1989 "shr ecx, 1",\
1990 "jnc prebeg",\
1991 "mov al, byte ptr [esi+8]",\
1992 "mov ah, byte ptr [esi+12]",\
1993 "shl eax, 16",\
1994 "mov al, byte ptr [esi]",\
1995 "mov ah, byte ptr [esi+4]",\
1996 "mov dword ptr [edi], eax",\
1997 "add esi, 16",\
1998 "add edi, 4",\
1999 "test ecx, ecx",\
2000 "prebeg: jz endit",\
2001 "beg: mov al, byte ptr [esi+8]",\
2002 "mov bl, byte ptr [esi+24]",\
2003 "mov ah, byte ptr [esi+12]",\
2004 "mov bh, byte ptr [esi+28]",\
2005 "shl eax, 16",\
2006 "add edi, 8",\
2007 "shl ebx, 16",\
2008 "mov al, byte ptr [esi]",\
2009 "mov bl, byte ptr [esi+16]",\
2010 "mov ah, byte ptr [esi+4]",\
2011 "mov bh, byte ptr [esi+20]",\
2012 "add esi, 32",\
2013 "mov dword ptr [edi-8], eax",\
2014 "dec ecx",\
2015 "mov dword ptr [edi-4], ebx",\
2016 "jnz beg",\
2017 "endit:",\
2018 parm [esi][edi][ecx]\
2019 modify exact [eax ebx ecx esi edi]\
2020
2021 #endif
2022
2023
2024 void swapchar(char *i1, char *i2);
2025 #pragma aux swapchar =\
2026 "mov cl, [eax]",\
2027 "mov ch, [ebx]",\
2028 "mov [ebx], cl",\
2029 "mov [eax], ch",\
2030 parm [eax][ebx]\
2031 modify exact [ecx]\
2032
2033 void swapshort(short *i1, short *i2);
2034 #pragma aux swapshort =\
2035 "mov cx, [eax]",\
2036 "mov dx, [ebx]",\
2037 "mov [ebx], cx",\
2038 "mov [eax], dx",\
2039 parm [eax][ebx]\
2040 modify exact [ecx edx]\
2041
2042 void swaplong(long *i1, long *i2);
2043 #pragma aux swaplong =\
2044 "mov ecx, [eax]",\
2045 "mov edx, [ebx]",\
2046 "mov [ebx], ecx",\
2047 "mov [eax], edx",\
2048 parm [eax][ebx]\
2049 modify exact [ecx edx]\
2050
2051 #pragma aux swapbuf4 =\
2052 "begswap:",\
2053 "mov esi, [eax]",\
2054 "mov edi, [ebx]",\
2055 "mov [ebx], esi",\
2056 "mov [eax], edi",\
2057 "add eax, 4",\
2058 "add ebx, 4",\
2059 "dec ecx",\
2060 "jnz short begswap",\
2061 parm [eax][ebx][ecx]\
2062 modify exact [eax ebx ecx esi edi]\
2063
2064 #pragma aux swap64bit =\
2065 "mov ecx, [eax]",\
2066 "mov edx, [ebx]",\
2067 "mov [ebx], ecx",\
2068 "mov ecx, [eax+4]",\
2069 "mov [eax], edx",\
2070 "mov edx, [ebx+4]",\
2071 "mov [ebx+4], ecx",\
2072 "mov [eax+4], edx",\
2073 parm [eax][ebx]\
2074 modify exact [ecx edx]\
2075
2076
2077 /*
2078 * swapchar2(ptr1,ptr2,xsiz); is the same as:
2079 * swapchar(ptr1,ptr2); swapchar(ptr1+1,ptr2+xsiz);
2080 */
2081 void swapchar2(char *ptr1, char *ptr2, long xsiz);
2082 #pragma aux swapchar2 =\
2083 "add esi, ebx",\
2084 "mov cx, [eax]",\
2085 "mov dl, [ebx]",\
2086 "mov [ebx], cl",\
2087 "mov dh, [esi]",\
2088 "mov [esi], ch",\
2089 "mov [eax], dx",\
2090 parm [eax][ebx][esi]\
2091 modify exact [ecx edx esi]\
2092
2093 static long timeroffs1mhz;
2094 /* accutimeroffs = -8-(t1-t0); */
2095 #pragma aux inittimer1mhz =\
2096 "xor ebx, ebx",\
2097 "xor ecx, ecx",\
2098 "in al, 0x61",\
2099 "or al, 1",\
2100 "out 0x61, al",\
2101 "mov al, 0x34",\
2102 "out 0x43, al",\
2103 "xor al, al",\
2104 "out 0x40, al",\
2105 "mov al, 0xb4",\
2106 "out 0x43, al",\
2107 "mov al, 240",\
2108 "out 0x42, al",\
2109 "xor al, al",\
2110 "cli",\
2111 "out 0x40, al",\
2112 "dec al",\
2113 "out 0x42, al",\
2114 "mov al, 0x04",\
2115 "out 0x43, al",\
2116 "in al, 0x40",\
2117 "mov bl, al",\
2118 "in al, 0x40",\
2119 "mov bh, al",\
2120 "mov al, 0x84",\
2121 "out 0x43, al",\
2122 "in al, 0x42",\
2123 "mov cl, al",\
2124 "in al, 0x42",\
2125 "sti",\
2126 "mov ch, al",\
2127 "sub ebx, ecx",\
2128 "sub ebx, 8",\
2129 "mov timeroffs1mhz, ebx",\
2130 modify exact [eax ebx ecx]\
2131
2132 #pragma aux uninittimer1mhz =\
2133 "in al, 0x61",\
2134 "and al, 252",\
2135 "out 0x61, al",\
2136 modify exact [eax]\
2137
2138 /* t = ((ecx-ebx+timeroffs1mhz)&0xfff0)*4095 + ecx; */
2139 #pragma aux gettime1mhz =\
2140 "mov ebx, timeroffs1mhz",\
2141 "xor ecx, ecx",\
2142 "mov al, 0x04",\
2143 "cli",\
2144 "out 0x43, al",\
2145 "in al, 0x40",\
2146 "sub bl, al",\
2147 "in al, 0x40",\
2148 "sbb bh, al",\
2149 "mov al, 0x84",\
2150 "out 0x43, al",\
2151 "in al, 0x42",\
2152 "mov cl, al",\
2153 "in al, 0x42",\
2154 "sti",\
2155 "mov ch, al",\
2156 "add ebx, ecx",\
2157 "and ebx, 0x0000fff0",\
2158 "sub ecx, ebx",\
2159 "shl ebx, 12",\
2160 "add ebx, ecx",\
2161 modify exact [eax ebx ecx]\
2162 value [ebx]\
2163
2164 /* eax = eax-ebx; if (eax < 0) eax += (1<<28) - (1<<16); */
2165 #pragma aux deltatime1mhz =\
2166 "sub eax, ebx",\
2167 "jnc skipit",\
2168 "add eax, 0x0fff0000",\
2169 "skipit:",\
2170 parm [ebx][eax]
2171
2172 #pragma aux boundmulscale =\
2173 "imul ebx",\
2174 "mov ebx, edx",\
2175 "shrd eax, edx, cl",\
2176 "sar edx, cl",\
2177 "xor edx, eax",\
2178 "js checkit",\
2179 "xor edx, eax",\
2180 "jz skipboundit",\
2181 "cmp edx, 0xffffffff",\
2182 "je skipboundit",\
2183 "checkit:",\
2184 "mov eax, ebx",\
2185 "sar eax, 31",\
2186 "xor eax, 0x7fffffff",\
2187 "skipboundit:",\
2188 parm nomemory [eax][ebx][ecx]\
2189 modify exact [eax ebx edx]\
2190
2191
2192 /* FIXME: Why are all these divscale functions in here a second time? */
2193 long divscale(long i1, long i2, long i3);
2194 #pragma aux divscale =\
2195 "mov edx, eax",\
2196 "shl eax, cl",\
2197 "neg cl",\
2198 "sar edx, cl",\
2199 "idiv ebx",\
2200 parm nomemory [eax][ebx][ecx]\
2201 modify exact [eax ecx edx]
2202
2203 long divscale1(long i1, long i2);
2204 #pragma aux divscale1 =\
2205 "add eax, eax",\
2206 "sbb edx, edx",\
2207 "idiv ebx",\
2208 parm nomemory [eax][ebx]\
2209 modify exact [eax edx]
2210
2211 long divscale2(long i1, long i2);
2212 #pragma aux divscale2 =\
2213 "mov edx, eax",\
2214 "sar edx, 30",\
2215 "lea eax, [eax*4]",\
2216 "idiv ebx",\
2217 parm nomemory [eax][ebx]\
2218 modify exact [eax edx]\
2219
2220 long divscale3(long i1, long i2);
2221 #pragma aux divscale3 =\
2222 "mov edx, eax",\
2223 "sar edx, 29",\
2224 "lea eax, [eax*8]",\
2225 "idiv ebx",\
2226 parm nomemory [eax][ebx]\
2227 modify exact [eax edx]\
2228
2229 long divscale4(long i1, long i2);
2230 #pragma aux divscale4 =\
2231 "mov edx, eax",\
2232 "sar edx, 28",\
2233 "shl eax, 4",\
2234 "idiv ebx",\
2235 parm nomemory [eax][ebx]\
2236 modify exact [eax edx]\
2237
2238 long divscale5(long i1, long i2);
2239 #pragma aux divscale5 =\
2240 "mov edx, eax",\
2241 "sar edx, 27",\
2242 "shl eax, 5",\
2243 "idiv ebx",\
2244 parm nomemory [eax][ebx]\
2245 modify exact [eax edx]\
2246
2247 long divscale6(long i1, long i2);
2248 #pragma aux divscale6 =\
2249 "mov edx, eax",\
2250 "sar edx, 26",\
2251 "shl eax, 6",\
2252 "idiv ebx",\
2253 parm nomemory [eax][ebx]\
2254 modify exact [eax edx]\
2255
2256 long divscale7(long i1, long i2);
2257 #pragma aux divscale7 =\
2258 "mov edx, eax",\
2259 "sar edx, 25",\
2260 "shl eax, 7",\
2261 "idiv ebx",\
2262 parm nomemory [eax][ebx]\
2263 modify exact [eax edx]\
2264
2265 long divscale8(long i1, long i2);
2266 #pragma aux divscale8 =\
2267 "mov edx, eax",\
2268 "sar edx, 24",\
2269 "shl eax, 8",\
2270 "idiv ebx",\
2271 parm nomemory [eax][ebx]\
2272 modify exact [eax edx]\
2273
2274 long divscale9(long i1, long i2);
2275 #pragma aux divscale9 =\
2276 "mov edx, eax",\
2277 "sar edx, 23",\
2278 "shl eax, 9",\
2279 "idiv ebx",\
2280 parm nomemory [eax][ebx]\
2281 modify exact [eax edx]\
2282
2283 long divscale10(long i1, long i2);
2284 #pragma aux divscale10 =\
2285 "mov edx, eax",\
2286 "sar edx, 22",\
2287 "shl eax, 10",\
2288 "idiv ebx",\
2289 parm nomemory [eax][ebx]\
2290 modify exact [eax edx]\
2291
2292 long divscale11(long i1, long i2);
2293 #pragma aux divscale11 =\
2294 "mov edx, eax",\
2295 "sar edx, 21",\
2296 "shl eax, 11",\
2297 "idiv ebx",\
2298 parm nomemory [eax][ebx]\
2299 modify exact [eax edx]\
2300
2301 long divscale12(long i1, long i2);
2302 #pragma aux divscale12 =\
2303 "mov edx, eax",\
2304 "sar edx, 20",\
2305 "shl eax, 12",\
2306 "idiv ebx",\
2307 parm nomemory [eax][ebx]\
2308 modify exact [eax edx]\
2309
2310 long divscale13(long i1, long i2);
2311 #pragma aux divscale13 =\
2312 "mov edx, eax",\
2313 "sar edx, 19",\
2314 "shl eax, 13",\
2315 "idiv ebx",\
2316 parm nomemory [eax][ebx]\
2317 modify exact [eax edx]\
2318
2319 long divscale14(long i1, long i2);
2320 #pragma aux divscale14 =\
2321 "mov edx, eax",\
2322 "sar edx, 18",\
2323 "shl eax, 14",\
2324 "idiv ebx",\
2325 parm nomemory [eax][ebx]\
2326 modify exact [eax edx]\
2327
2328 long divscale15(long i1, long i2);
2329 #pragma aux divscale15 =\
2330 "mov edx, eax",\
2331 "sar edx, 17",\
2332 "shl eax, 15",\
2333 "idiv ebx",\
2334 parm nomemory [eax][ebx]\
2335 modify exact [eax edx]\
2336
2337 long divscale16(long i1, long i2);
2338 #pragma aux divscale16 =\
2339 "mov edx, eax",\
2340 "sar edx, 16",\
2341 "shl eax, 16",\
2342 "idiv ebx",\
2343 parm nomemory [eax][ebx]\
2344 modify exact [eax edx]\
2345
2346 long divscale17(long i1, long i2);
2347 #pragma aux divscale17 =\
2348 "mov edx, eax",\
2349 "sar edx, 15",\
2350 "shl eax, 17",\
2351 "idiv ebx",\
2352 parm nomemory [eax][ebx]\
2353 modify exact [eax edx]\
2354
2355 long divscale18(long i1, long i2);
2356 #pragma aux divscale18 =\
2357 "mov edx, eax",\
2358 "sar edx, 14",\
2359 "shl eax, 18",\
2360 "idiv ebx",\
2361 parm nomemory [eax][ebx]\
2362 modify exact [eax edx]\
2363
2364 long divscale19(long i1, long i2);
2365 #pragma aux divscale19 =\
2366 "mov edx, eax",\
2367 "sar edx, 13",\
2368 "shl eax, 19",\
2369 "idiv ebx",\
2370 parm nomemory [eax][ebx]\
2371 modify exact [eax edx]\
2372
2373 long divscale20(long i1, long i2);
2374 #pragma aux divscale20 =\
2375 "mov edx, eax",\
2376 "sar edx, 12",\
2377 "shl eax, 20",\
2378 "idiv ebx",\
2379 parm nomemory [eax][ebx]\
2380 modify exact [eax edx]\
2381
2382 long divscale21(long i1, long i2);
2383 #pragma aux divscale21 =\
2384 "mov edx, eax",\
2385 "sar edx, 11",\
2386 "shl eax, 21",\
2387 "idiv ebx",\
2388 parm nomemory [eax][ebx]\
2389 modify exact [eax edx]\
2390
2391 long divscale22(long i1, long i2);
2392 #pragma aux divscale22 =\
2393 "mov edx, eax",\
2394 "sar edx, 10",\
2395 "shl eax, 22",\
2396 "idiv ebx",\
2397 parm nomemory [eax][ebx]\
2398 modify exact [eax edx]\
2399
2400 long divscale23(long i1, long i2);
2401 #pragma aux divscale23 =\
2402 "mov edx, eax",\
2403 "sar edx, 9",\
2404 "shl eax, 23",\
2405 "idiv ebx",\
2406 parm nomemory [eax][ebx]\
2407 modify exact [eax edx]\
2408
2409 long divscale24(long i1, long i2);
2410 #pragma aux divscale24 =\
2411 "mov edx, eax",\
2412 "sar edx, 8",\
2413 "shl eax, 24",\
2414 "idiv ebx",\
2415 parm nomemory [eax][ebx]\
2416 modify exact [eax edx]\
2417
2418 long divscale25(long i1, long i2);
2419 #pragma aux divscale25 =\
2420 "mov edx, eax",\
2421 "sar edx, 7",\
2422 "shl eax, 25",\
2423 "idiv ebx",\
2424 parm nomemory [eax][ebx]\
2425 modify exact [eax edx]\
2426
2427 long divscale26(long i1, long i2);
2428 #pragma aux divscale26 =\
2429 "mov edx, eax",\
2430 "sar edx, 6",\
2431 "shl eax, 26",\
2432 "idiv ebx",\
2433 parm nomemory [eax][ebx]\
2434 modify exact [eax edx]\
2435
2436 long divscale27(long i1, long i2);
2437 #pragma aux divscale27 =\
2438 "mov edx, eax",\
2439 "sar edx, 5",\
2440 "shl eax, 27",\
2441 "idiv ebx",\
2442 parm nomemory [eax][ebx]\
2443 modify exact [eax edx]\
2444
2445 long divscale28(long i1, long i2);
2446 #pragma aux divscale28 =\
2447 "mov edx, eax",\
2448 "sar edx, 4",\
2449 "shl eax, 28",\
2450 "idiv ebx",\
2451 parm nomemory [eax][ebx]\
2452 modify exact [eax edx]\
2453
2454 long divscale29(long i1, long i2);
2455 #pragma aux divscale29 =\
2456 "mov edx, eax",\
2457 "sar edx, 3",\
2458 "shl eax, 29",\
2459 "idiv ebx",\
2460 parm nomemory [eax][ebx]\
2461 modify exact [eax edx]\
2462
2463 long divscale30(long i1, long i2);
2464 #pragma aux divscale30 =\
2465 "mov edx, eax",\
2466 "sar edx, 2",\
2467 "shl eax, 30",\
2468 "idiv ebx",\
2469 parm nomemory [eax][ebx]\
2470 modify exact [eax edx]\
2471
2472 long divscale31(long i1, long i2);
2473 #pragma aux divscale31 =\
2474 "mov edx, eax",\
2475 "sar edx, 1",\
2476 "shl eax, 31",\
2477 "idiv ebx",\
2478 parm nomemory [eax][ebx]\
2479 modify exact [eax edx]\
2480
2481 long divscale32(long i1, long i2);
2482 #pragma aux divscale32 =\
2483 "xor eax, eax",\
2484 "idiv ebx",\
2485 parm nomemory [edx][ebx]\
2486 modify exact [eax edx]
2487
2488 #else /* non-Watcom platforms land here: */
2489
2490 #include "platform.h" //for __int64
2491
2492 static __inline void swapchar(unsigned char *p1, unsigned char *p2)
2493 { unsigned char tmp = *p1; *p1 = *p2; *p2 = tmp; }
2494 static __inline void swapshort(short *p1, short *p2)
2495 { short tmp = *p1; *p1 = *p2; *p2 = tmp; }
2496 static __inline void swaplong(long *p1, long *p2)
2497 { long tmp = *p1; *p1 = *p2; *p2 = tmp; }
2498 static __inline void swapchar2(unsigned char *p1, unsigned char *p2, int xsiz)
2499 {
2500 swapchar(p1, p2);
2501 swapchar(p1 + 1, p2 + xsiz);
2502 }
2503
2504
2505 unsigned long getkensmessagecrc(long param);
2506 long msqrtasm(int i1);
2507
2508 void vlin16first (long i1, long i2);
2509
2510 static __inline int sqr (int input1) { return input1*input1; }
2511
2512 /* internal use:32x32 = 64bit */
2513 static __inline __int64 mul32_64(int i1,int i2)
2514 {
2515 return (__int64)i1*i2;
2516 }
2517 static __inline int scale (int input1, int input2, int input3)
2518 {
2519 return mul32_64(input1,input2)/input3;
2520 }
2521 static __inline int mulscale (int input1, int input2, int input3)
2522 {
2523 return mul32_64(input1,input2)>>input3;
2524 }
2525 static __inline int dmulscale (int input1, int input2, int input3,int input4,int input5)
2526 {
2527 return (mul32_64(input1,input2) + mul32_64(input3,input4))>>input5;
2528 }
2529 static __inline int tmulscale(int i1, int i2, int i3, int i4, int i5, int i6,int shift)
2530 {
2531 return (mul32_64(i1,i2) + mul32_64(i3,i4) + mul32_64(i5,i6))>>shift;
2532 }
2533 static __inline int divscale(int i1, int i2, int i3)
2534 {
2535 return ((__int64)i1<<i3)/i2;
2536 }
2537
2538 #define DEFFUNCS \
2539 DEFFUN(1)\
2540 DEFFUN(2)\
2541 DEFFUN(3)\
2542 DEFFUN(4)\
2543 DEFFUN(5)\
2544 DEFFUN(6)\
2545 DEFFUN(7)\
2546 DEFFUN(8)\
2547 DEFFUN(9)\
2548 DEFFUN(10)\
2549 DEFFUN(11)\
2550 DEFFUN(12)\
2551 DEFFUN(13)\
2552 DEFFUN(14)\
2553 DEFFUN(15)\
2554 DEFFUN(16)\
2555 DEFFUN(17)\
2556 DEFFUN(18)\
2557 DEFFUN(19)\
2558 DEFFUN(20)\
2559 DEFFUN(21)\
2560 DEFFUN(22)\
2561 DEFFUN(23)\
2562 DEFFUN(24)\
2563 DEFFUN(25)\
2564 DEFFUN(26)\
2565 DEFFUN(27)\
2566 DEFFUN(28)\
2567 DEFFUN(29)\
2568 DEFFUN(30)\
2569 DEFFUN(31)\
2570 DEFFUN(32)
2571
2572 #define DEFFUN(N) \
2573 static __inline int mulscale##N(int input1, int input2) \
2574 { return mulscale(input1,input2,N); }
2575 DEFFUNCS
2576 #undef DEFFUN
2577
2578 #define DEFFUN(N) \
2579 static __inline int dmulscale##N(int input1, int input2,int input3,int input4) \
2580 { return dmulscale(input1,input2,input3,input4,N); }
2581 DEFFUNCS
2582 #undef DEFFUN
2583
2584 #define DEFFUN(N) \
2585 static __inline int tmulscale##N(int i1, int i2,int i3,int i4,int i5,int i6) \
2586 { return tmulscale(i1,i2,i3,i4,i5,i6,N); }
2587 DEFFUNCS
2588 #undef DEFFUN
2589
2590 #define DEFFUN(N) \
2591 static __inline int divscale##N(int input1, int input2) \
2592 { return divscale(input1,input2,N); }
2593 DEFFUNCS
2594 #undef DEFFUN
2595
2596 static __inline int ksgn(int i1)
2597 {
2598 if (i1 < 0) return -1;
2599 else if (i1 > 0) return 1;
2600 else return 0;
2601 }
2602
2603 static __inline int sgn(int i1) { return ksgn(i1); }
2604 static __inline int klabs (int i1)
2605 {
2606 if (i1 < 0) i1 = -i1;
2607 return i1;
2608 }
2609 static __inline int mul3 (int i1) { return i1*3; }
2610 static __inline int mul5 (int i1) { return i1*5; }
2611 static __inline int mul9 (int i1) { return i1*9; }
2612
2613 void copybufreverse(void *source, void *dest, int size);
2614 void copybuf(void *source, void *dest, int size);
2615 void clearbuf(void *buffer, int size, long fill_value);
2616 void clearbufbyte(void *buffer, int size, long fill_value);
2617 void copybufbyte(void *source, void *dest, int size);
2618
2619 void qinterpolatedown16 (long *source, int size, int linum, int linum_inc);
2620 void qinterpolatedown16short (long *source, int size, int linum, int linum_inc);
2621
2622 #endif /* defined __WATCOMC__ */
2623
2624 #endif /* !defined _INCLUDE_PRAGMAS_H_ */
2625
2626 /* end of pragmas.h ... */
2627
2628