added copyright line to top of source files next to license information
[cyclone68000.git] / Pico / MakeSine.cpp
1 \r
2 // This file is part of the PicoDrive Megadrive Emulator\r
3 \r
4 // Copyright (c) 2011 FinalDave (emudave (at) gmail.com)\r
5 \r
6 // This code is licensed under the GNU General Public License version 2.0 and the MAME License.\r
7 // You can choose the license that has the most advantages for you.\r
8 \r
9 // SVN repository can be found at http://code.google.com/p/cyclone68000/\r
10 \r
11 // Make a Sine table\r
12 \r
13 #pragma warning (disable:4514)\r
14 \r
15 #include <stdio.h>\r
16 #include <stdlib.h>\r
17 #include <string.h>\r
18 #include <math.h>\r
19 \r
20 #define PI 3.14159265358979\r
21 \r
22 int main()\r
23 {\r
24   int i=0;\r
25 \r
26   printf ("\nshort Sine[0x100]=\n");\r
27   printf ("{\n");\r
28 \r
29   for (i=0;i<0x100;i++)\r
30   {\r
31     double fAng,fPos;\r
32     int nPos;\r
33     if ((i&7)==0) printf ("  ");\r
34     \r
35     fAng=(double)i/(double)0x100;\r
36     fAng*=2*PI;\r
37     fPos=sin(fAng)*(double)0x4000;\r
38     nPos=(int)fPos;\r
39     printf ("%+6d,",nPos);\r
40     \r
41     if ((i&7)==7) printf ("\n");\r
42   }\r
43 \r
44   printf ("};\n");\r
45 \r
46   return 0;\r
47 }\r