/*
 * fixedPt.h
 *
 * [Generated from fixedPt, 25 September 1996]
 */

#if !defined(__CC_NORCROFT) || !defined(__arm)
  #error You must use the Norcroft ARM Compiler for Sapphire programs
#endif

#pragma include_only_once
#pragma force_top_level

#ifndef __fixedPt_h
#define __fixedPt_h

#ifndef __sapphire_h
  #include "sapphire.h"
#endif

/*----- Overview ----------------------------------------------------------*
 *
 * Functions provided:
 *
 *  fxp_atan
 *  fxp_pol
 *  fxp_sin
 *  fxp_cos
 */

/* --- fxp_atan --- *
 *
 * On entry:	R0 == x, in 16.16 fixed point form
 *
 * On exit:	R0 == arctan x, in degrees, in 16.16 fixed point
 *
 * Use:		Calculates arctan x, hopefully fairly swiftly. The
 *		accuracy of the result is open to doubt, although
 *		it's usually good to about 3 significant figures.
 *		It uses a small lookup table and linear interpolation
 *		to calculate the result.
 */

extern routine fxp_atan;

/* --- fxp_pol --- *
 *
 * On entry:	R0 == x coordinate
 * 		R1 == y coordinate
 *
 * On exit:	R0 == angle in degrees, in 16.16 form
 *
 * Use:		Calculates the angle a vector makes with the +ve x axis.
 *		The angle is given in degrees, rather than radians,
 *		although this isn't really overly significant; it just
 *		makes it slightly easier to work with, because it's
 *		bigger.
 *
 *		This routine uses the arctan table and linear
 *		interpolation, so it's fairly quick, but the accuracy
 *		of its results is restricted to about 3 significant figures.
 */

extern routine fxp_pol;

/* --- fxp_sin --- *
 *
 * On entry:	R0 == angle in degrees, in 16.16 form
 *
 * On exit:	R0 == sin of angle, in 16.16 form
 *
 * Use:		Calculates a sin of an angle with a degree of swiftness and
 *		a lot less accuracy.
 */

extern routine fxp_sin;

/* --- fxp_cos --- *
 *
 * On entry:	R0 == angle in degrees, in 16.16 form
 *
 * On exit:	R0 == cos of angle, in 16.16 form
 *
 * Use:		Calculates a cos of an angle with a degree of swiftness and
 *		a lot less accuracy.
 */

extern routine fxp_cos;

/*----- That's all, folks -------------------------------------------------*/

#endif
