Initial revision
[ssr] / StraySrc / Libraries / Sapphire / sh / fixedPt
1 ;
2 ; fixedPt.sh
3 ;
4 ; Provides fixed point operations such as trignometry
5 ;
6 ; © 1994-1998 Straylight
7 ;
8
9 ;----- Licensing note -------------------------------------------------------
10 ;
11 ; This file is part of Straylight's Sapphire library.
12 ;
13 ; Sapphire is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
16 ; any later version.
17 ;
18 ; Sapphire is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ; GNU General Public License for more details.
22 ;
23 ; You should have received a copy of the GNU General Public License
24 ; along with Sapphire. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
27 ;----- Overview -------------------------------------------------------------
28 ;
29 ; Functions provided:
30 ;
31 ; fxp_atan
32 ; fxp_pol
33 ; fxp_sin
34 ; fxp_cos
35
36 [ :LNOT::DEF:fixedPt__dfn
37 GBLL fixedPt__dfn
38
39 ; --- fxp_atan ---
40 ;
41 ; On entry: R0 == x, in 16.16 fixed point form
42 ;
43 ; On exit: R0 == arctan x, in degrees, in 16.16 fixed point
44 ;
45 ; Use: Calculates arctan x, hopefully fairly swiftly. The
46 ; accuracy of the result is open to doubt, although
47 ; it's usually good to about 3 significant figures.
48 ; It uses a small lookup table and linear interpolation
49 ; to calculate the result.
50
51 IMPORT fxp_atan
52
53 ; --- fxp_pol ---
54 ;
55 ; On entry: R0 == x coordinate
56 ; R1 == y coordinate
57 ;
58 ; On exit: R0 == angle in degrees, in 16.16 form
59 ;
60 ; Use: Calculates the angle a vector makes with the +ve x axis.
61 ; The angle is given in degrees, rather than radians,
62 ; although this isn't really overly significant; it just
63 ; makes it slightly easier to work with, because it's
64 ; bigger.
65 ;
66 ; This routine uses the arctan table and linear
67 ; interpolation, so it's fairly quick, but the accuracy
68 ; of its results is restricted to about 3 significant figures.
69
70 IMPORT fxp_pol
71
72 ; --- fxp_sin ---
73 ;
74 ; On entry: R0 == angle in degrees, in 16.16 form
75 ;
76 ; On exit: R0 == sin of angle, in 16.16 form
77 ;
78 ; Use: Calculates a sin of an angle with a degree of swiftness and
79 ; a lot less accuracy.
80
81 IMPORT fxp_sin
82
83 ; --- fxp_cos ---
84 ;
85 ; On entry: R0 == angle in degrees, in 16.16 form
86 ;
87 ; On exit: R0 == cos of angle, in 16.16 form
88 ;
89 ; Use: Calculates a cos of an angle with a degree of swiftness and
90 ; a lot less accuracy.
91
92 IMPORT fxp_cos
93
94 ]
95
96 ;----- That's all, folks ----------------------------------------------------
97
98 END