contrib/OWB: add correct SDL dependency, fix compilers used
[AROS-Contrib.git] / freetype1 / pascal / lib / ttcalc4.inc
blob7bd08226ff0cb81960fc99b84d286bd3661eb4c8
1 (*******************************************************************
2  *
3  *  TTCalc4.Inc                                                 1.2
4  *
5  *    Arithmetic and Vectorial Computations (inline assembly)
6  *    This version is used for i386 FreePascal
7  *
8  *  Copyright 1996 David Turner, Robert Wilhelm and Werner Lemberg
9  *
10  *  This file is part of the FreeType project, and may only be used
11  *  modified and distributed under the terms of the FreeType project
12  *  license, LICENSE.TXT. By continuing to use, modify or distribute
13  *  this file you indicate that you have read the license and
14  *  understand and accept it fully.
15  *
16  *  NOTES : All vector operations were moved to the interpreter
17  *
18  ******************************************************************)
20 (**********************************************************)
21 (*                                                        *)
22 (* The following routines are inline assembly, they are   *)
23 (* thus processor and bitness specific. Replace them      *)
24 (* with your own if you want to port the TrueType Engine  *)
26 (**********************************************************)
27 (* 64 Bit Addition                                        *)
29 procedure Add64( var X, Y, Z : Int64 ); assembler;
30 asm
31   push %ebx
32   push %edx
34   mov  X,%ebx
35   mov  (%ebx)  ,%eax
36   mov  4(%ebx) ,%edx
38   mov  Y,%ebx
39   add  (%ebx)  ,%eax
40   adc  4(%ebx) ,%edx
42   mov  Z,%ebx
43   mov  %eax, (%ebx)
44   mov  %edx, 4(%ebx)
46   pop  %edx
47   pop  %ebx
48 end;
51 (**********************************************************)
52 (* 64 Bit Substraction                                    *)
54 procedure Sub64( var X, Y, Z : Int64 ); assembler;
55 asm
56   push %ebx
57   push %edx
59   mov  X,%ebx
60   mov  (%ebx)  ,%eax
61   mov  4(%ebx) ,%edx
63   mov  Y,%ebx
64   sub  (%ebx)  ,%eax
65   sbb  4(%ebx) ,%edx
67   mov  Z,%ebx
68   mov  %eax, (%ebx)
69   mov  %edx, 4(%ebx)
71   pop  %edx
72   pop  %ebx
73 end;
76 (**********************************************************)
77 (* Multiply two Int32 to an Int64                         *)
79 procedure MulTo64( X, Y : Int32; var Z : Int64 ); assembler;
80 asm
81   push  %ebx
82   push  %edx
84   mov   X,%eax
85   imull Y
87   mov   Z,%ebx
88   mov   %eax, (%ebx)
89   mov   %edx, 4(%ebx)
91   pop   %edx
92   pop   %ebx
93 end;
96 (**********************************************************)
97 (* Divide an Int64 by an Int32                            *)
99 function Div64by32( var X : Int64; Y : Int32 ) : Int32; assembler;
101   push  %ebx
102   push  %edx
104   mov  X,%ebx
105   mov  (%ebx)  ,%eax
106   mov  4(%ebx) ,%edx
107   idivl Y
109   pop  %edx
110   pop  %ebx
111 end;
114 procedure DivMod64by32( var X : Int64; Y : Int32; var Q, R : Int32 );
115           assembler;
117   push  %ebx
118   push  %edx
120   mov  X,%ebx
121   mov  (%ebx)  ,%eax
122   mov  4(%ebx) ,%edx
123   idivl Y
125   mov  Q, %ebx
126   mov  %eax, (%ebx)
128   mov  R, %ebx
129   mov  %edx, (%ebx)
131   pop  %edx
132   pop  %ebx
133 end;