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