Modules/math

From MSX Game Library

< Modules

math

Code: math.h

Category: Core

Dependencies: None

Samples:

The math module offers a range of mathematical functions optimized for the Z80.

Usage

To use this module, include "math.h" in your source code, and add "math" to the modules list (LibModules) in your project's configuration file (project_config.js).

Note: To use the macros, you only need to include the header. No need to add the module in your project configuration.

Samples

See module use cases in the sample programs:

Settings

Library configuration (msxgl_config.h):

// Random methods
// - RANDOM_8_NONE ................ No 8-bits random
// - RANDOM_8_REGISTER ............ R Register value (7-bits)
// - RANDOM_8_RACC ................ R Register accumulation (7-bits)
// - RANDOM_8_ION ................. Ion Random
// - RANDOM_8_MEMORY .............. Memory Peek from R
#define RANDOM_8_METHOD				RANDOM_8_ION
// - RANDOM_16_NONE ............... No 16-bits random
// - RANDOM_16_LINEAR ............. Linear congruential
// - RANDOM_16_XORSHIFT ........... XOR Shift
// - RANDOM_16_LFSR_LCG ........... Combined LFSR/LCG
#define RANDOM_16_METHOD			RANDOM_16_XORSHIFT

Dependencies

Dependency on other modules: None

Documentation