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

FILE	*fpw,*fpw2;

#define		R 0x30
#define		R2 (int)(0x20/3.141592654+0.5)
#define		V 1

unsigned char	xx[0x40];
unsigned char	xx2[0x40];
unsigned char	yy[0x40];
unsigned char	yy2[0x40];
unsigned char	c[0x40][0x40];

main()
{
	static char	filename[] = {"cir-X.TXT"};
	static char	cpcom1[] = {"mv "};
	static char	cpcom2[] = {" ../asm/"};
	char	c[125];

	printf("\n\n\n<<<<< CIRCLE X DATA START !! >>>>>\t\n\n\n");

	if(( fpw = fopen(filename,"w")) == NULL){
		printf("Write file open error !!\n");
		exit(1);
	}

	cir_full();

	fclose(fpw);

	printf("\n\n<<<<< CIRCLE X DATA END !! >>>>>\n\n\n");
/**************************/
	strcpy(c,cpcom1);
	strcat(c,filename);
	strcat(c, cpcom2);
	strcat(c,filename);
	printf("\n%s\n",c);
	system(c);
/**************************/
}

cir_full()
{
	double	x,y,v;
	int	i;
	unsigned char	cc;

	fprintf(fpw,"CIR_X\tEQU\t$\n");

	for(x=(R),i=0;x>(-R);x--){
		if (i-((i/8)*8) == 0){
			fprintf(fpw,"\tWORD\t");
		}

		y = sqrt(( R * R ) - ( x * x ));
		y *= 5.3333;
		fprintf(fpw,"%05XH",(short)(y));
		printf("%05XH",(short)(y));
		i++;

		if (i-((i/8)*8) == 0){
			fprintf(fpw,"\n");
			printf("\n");
		}
		else if(x != (-R)){
			fprintf(fpw,",");
			printf(",");
		}

	}

	fprintf(fpw,";\n");
}

