The SGADE Documentation

the SGADE The Socrates Gameboy Advance Development Engine

The SGADE is a development library for the Nintendo Gameboy Advance. It's free for all uses and is distributed without guarantees. For more information visit the SGADE page.


Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

SoTables

All generic precalculated tables. More...

Files

file  SoTables.c
file  SoTables.h

Defines

#define SO_ONE_OVER_N_MAX_N
 Range of the one-over-N table.

#define SO_ONE_OVER_N_INDEX_Q
 Number of bits for fraction of entries in the one-over-N table. (see g_OneOver).

#define SO_FADE_BITS
 Number of bits allowed for fading-precision.

#define SO_FADE_STEPS
 Number of fade steps allowed (see g_Fade).

#define SO_FADE_MAX
 Maximum fade value (see g_Fade).


Variables

const sofixedpointg_Sine
 For internal use only. Use the SO_SINE() macro istead.

const sofixedpointg_Cosine
 For internal use only. Use the SO_COSINE() macro instead.

const sofixedpoint g_OneOver [SO_ONE_OVER_N_MAX_N<< SO_ONE_OVER_N_INDEX_Q]
 Reciprocal table for fast 1/N calculations.

const u8 g_Fade [SO_FADE_STEPS *256]
 Table for fast (cross)fading.


Detailed Description

All generic precalculated tables.

Singleton

Contains every precalculated table that is used in more than one place in the SGADE. That is, the general ones. Those that belong to a specific class are defined there.


Define Documentation

#define SO_FADE_BITS
 

Number of bits allowed for fading-precision.

We use a precalculated table for speedy-fading but because we need to be carefull of speed and size we don't allow the full 8 bits range for fades. The following constants define the range allowed. The table is SO_FADE_STEPS times 256 bytes big.

See g_Fade for more information.

#define SO_ONE_OVER_N_MAX_N
 

Range of the one-over-N table.

I use a table for fast (1 / N) calculations. Obviously we cannot make this table too big. Because we want a bit more precision we allow this indexed-division to have a couple of bits for the fraction. That is defined by the following value. The table is SO_ONE_OVER_N_MAX_N times 2^SO_ONE_OVER_N_INDEX_Q times 4 bytes big.

See g_OneOver for more information.


Variable Documentation

const sofixedpoint* g_Cosine  
 

For internal use only. Use the SO_COSINE() macro instead.

This is a precalculated cosine table that contains a fixed point sine value for every index. A full circle is 256 degrees. This table shares some entries with the sine table (it starts a quarter of a circle (64 degrees) later).

const u8 g_Fade[ SO_FADE_STEPS * 256 ]  
 

Table for fast (cross)fading.

This table contains SO_FADE_STEPS rows of 256 numbers, where each row represents the 1..256 list of numbers scaled by SO_FADE_STEPS divided by the given index number.

If that isn't clear, let me know and I'll update the documents.

const sofixedpoint g_OneOver[ SO_ONE_OVER_N_MAX_N << SO_ONE_OVER_N_INDEX_Q ]  
 

Reciprocal table for fast 1/N calculations.

This table can be used to do fast 1/N calculations.

If N is a number in the range [0..SO_ONE_OVER_N_MAX_N] having a SO_ONE_OVER_N_INDEX_Q bits fraction, then g_OneOver[ N ] equals 1 / N in the Socrates fixed format.

This table is also used in the SO_FIXED_ONE_OVER_FAST_INACCURATE macro.

const sofixedpoint* g_Sine  
 

For internal use only. Use the SO_SINE() macro istead.

This is a precalculated sine table that contains a fixed point sine value for every index. A full circle is 256 degrees.


Copyright 2002 by the SGADE authors. See SoLicense.h or Visit the SGADE page for more information.