Skip to content

ProxyPlayerHD/cc65-FixedMath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cc65-FixedMath

A Simple Fixed Point Math Library for cc65, it uses the Q16.16 Format

Using it is simple, just include the .h file in your c source file and tell ld65 to include the .lib file when linking.

Implemented Functions:

  • Conversion:
    • itox(value);
    • atox(value);
    • xtoi(value);
    • xtoa(value, string, decimal_places);
    • xtoaf(value, decimal_places);
  • Arithmetic:
    • xmul(multiplier, multiplicand);
    • xdiv(Dividend, Divisor);
    • xabs(value);
    • xsqrt(value);
    • xexp(value);
    • xlog(value);
    • xlog2(value);
  • Trigonometric
    • xsin(inAngle);
    • xcos(inAngle);
    • xtan(inAngle);
    • xasin(inAngle);
    • xacos(inAngle);
    • xatan(inAngle);
    • xatan2(inY, inX);

Defined Values:

FX_MAX		= 0x7FFFFFFF	// Maximum Value
FX_MIN		= 0x80000000	// Minimum Value
FX_OVFL		= 0x80000000	// Overflow Value
FX_ONE		= 0x00010000	// 1.0
FX_PIHALF	= 0x0001921F	// PI/2
FX_PI		= 0x0003243F	// PI
FX_PI2		= 0x0006487E	// PI*2
FX_4DPI		= 0x000145F3	// 4/PI
FX_PID4		= 0x0000C90F	// PI/4
FX_3PID4	= 0x00025B2F	// PI*3/4
FX_E		= 0x0002B7E1	// e (2.71828182846)
FX_ET2		= 0x00369920	// e^4

About

A Fixed Point Library for cc65, uses the Q16.16 format

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages