#include <math.h>
#include <stdio.h>

#define PI	3.1415927
#define unchar	unsigned char
FILE *fpw0;

main()
{
	/****** ram set ******/
	float s,ss;
	long i,psum,angle,x,y,radius;

	/***** init. set *****/
	printf("How many points ( decimal ) ?\t");
	scanf("%d", &psum);
	printf("How long a radius ( hex ) ?\t");
	scanf("%x", &radius);
	angle=36000/psum;

	/****** write file open ******/
	if((fpw0=fopen("bg3pol.dat","w")) == 0){
		printf("can't open !!\n");
		exit(1);
	}

	/****** BG3 OBAKE data make ******/

	for(i=0;i<psum;i++){
		ss=360.0-i*angle/100;

		s=ss*PI/180;
		x=cos(s)*radius;
		y=sin(s)*radius;

		fprintf(fpw0,"\n\t\tHEX\t%03X,%03X",(unchar)y,(unchar)x);
	}
	fprintf(fpw0,"\n");

        /****** write file close ******/
	fclose(fpw0);
}
