libtonc: tonc_bios.h File Reference

Tonclib

tonc_bios.h File Reference

#include "tonc_types.h"

Data Structures

struct  BUP
 BitUpPack ( for swi 10h). More...
struct  MultiBootParam
 Multiboot struct. More...

Defines

#define swi_call(x)   asm volatile("swi\t"#x"<<16" ::: "r0", "r1", "r2", "r3")
 BIOS calls from C.
#define DivMod   Mod
SoftReset flags
#define ROM_RESTART   0x00
 Restart from ROM entry point.
#define RAM_RESTART   0x01
 Restart from RAM entry point.
RegisterRamReset flags
#define RESET_EWRAM   0x0001
 Clear 256K on-board WRAM.
#define RESET_IWRAM   0x0002
 Clear 32K in-chip WRAM.
#define RESET_PALETTE   0x0004
 Clear Palette.
#define RESET_VRAM   0x0008
 Clear VRAM.
#define RESET_OAM   0x0010
 Clear OAM. does NOT disable OBJs!
#define RESET_REG_SIO   0x0020
 Switches to general purpose mode.
#define RESET_REG_SOUND   0x0040
 Reset Sound registers.
#define RESET_REG   0x0080
 All other registers.
#define RESET_MEM_MASK   0x001F
 Clear 256K on-board WRAM.
#define RESET_REG_MASK   0x00E0
 Clear 256K on-board WRAM.
#define RESET_GFX   0x001C
 Clear all gfx-related memory.
Cpu(Fast)Set flags
#define CS_CPY   0
 Copy mode.
#define CS_FILL   (1<<24)
 Fill mode.
#define CS_CPY16   0
 Copy in halfwords.
#define CS_CPY32   (1<<26)
 Copy words.
#define CS_FILL32   (5<<24)
 Fill words.
#define CFS_CPY   CS_CPY
 Copy words.
#define CFS_FILL   CS_FILL
 Fill words.
ObjAffineSet P-element offsets
#define BG_AFF_OFS   2
 BgAffineDest offsets.
#define OBJ_AFF_OFS   8
 ObjAffineDest offsets.
Decompression routines
#define BUP_ALL_OFS   (1<<31)
#define LZ_TYPE   0x00000010
#define LZ_SIZE_MASK   0xFFFFFF00
#define LZ_SIZE_SHIFT   8
#define HUF_BPP_MASK   0x0000000F
#define HUF_TYPE   0x00000020
#define HUF_SIZE_MASK   0xFFFFFF00
#define HUF_SIZE_SHIFT   8
#define RL_TYPE   0x00000030
#define RL_SIZE_MASK   0xFFFFFF00
#define RL_SIZE_SHIFT   8
#define DIF_8   0x00000001
#define DIF_16   0x00000002
#define DIF_TYPE   0x00000080
#define DIF_SIZE_MASK   0xFFFFFF00
#define DIF_SIZE_SHIFT   8
Multiboot modes
#define MBOOT_NORMAL   0x00
#define MBOOT_MULTI   0x01
#define MBOOT_FAST   0x02

Functions

u32 BiosCheckSum (void)
void VBlankIntrDelay (u32 count)
 Wait for count frames.
int DivSafe (int num, int den)
 Div/0-safe division.
int Mod (int num, int den)
 Modulo: num % den.
u32 DivAbs (int num, int den)
 Absolute value of num / den.
int DivArmMod (int den, int num)
 Modulo: num % den.
u32 DivArmAbs (int den, int num)
 Absolute value of num / den.
void CpuFastFill (u32 wd, void *dst, u32 mode)
 A fast word fill.
Reset functions
void SoftReset (void)
void RegisterRamReset (u32 flags)
Halt functions
void Halt (void)
void Stop (void)
void IntrWait (u32 flagClear, u32 irq)
void VBlankIntrWait (void)
 Wait for the next VBlank (swi 05h).
Math functions
s32 Div (s32 num, s32 den)
 Basic integer division (swi 06h).
s32 DivArm (s32 den, s32 num)
 Basic integer division, but with switched arguments (swi 07h).
u32 Sqrt (u32 num)
 Integer Square root (swi 08h).
s16 ArcTan (s16 dydx)
 Arctangent of dydx (swi 08h).
s16 ArcTan2 (s16 x, s16 y)
 Arctangent of a coordinate pair (swi 09h).
Memory copiers/fillers
void CpuSet (const void *src, void *dst, u32 mode)
 Transfer via CPU in (half)word chunks.
void CpuFastSet (const void *src, void *dst, u32 mode)
 A fast transfer via CPU in 32 byte chunks.
Rot/scale functions
void ObjAffineSet (const ObjAffineSource *src, void *dst, s32 num, s32 offset)
 Sets up a simple scale-then-rotate affine transformation (swi 0Eh).
void BgAffineSet (const BgAffineSource *src, BgAffineDest *dst, s32 num)
 Sets up a simple scale-then-rotate affine transformation (swi 0Eh).
Decompression (see GBATek for format details)
void BitUnPack (const void *src, void *dst, const BUP *bup)
void LZ77UnCompWram (const void *src, void *dst)
void LZ77UnCompVram (const void *src, void *dst)
void HuffUnComp (const void *src, void *dst)
void RLUnCompWram (const void *src, void *dst)
void RLUnCompVram (const void *src, void *dst)
void Diff8bitUnFilterWram (const void *src, void *dst)
void Diff8bitUnFilterVram (const void *src, void *dst)
void Diff16bitUnFilter (const void *src, void *dst)
Sound Functions
void SoundBias (u32 bias)
void SoundDriverInit (void *src)
void SoundDriverMode (u32 mode)
void SoundDriverMain (void)
void SoundDriverVSync (void)
void SoundChannelClear (void)
u32 MidiKey2Freq (void *wa, u8 mk, u8 fp)
void SoundDriverVSyncOff (void)
void SoundDriverVSyncOn (void)
Multiboot handshake
int MultiBoot (MultiBootParam *mb, u32 mode)

Detailed Description

Author:
J Vijn
Date:
20060508 - 20070208

Generated on Mon Aug 25 17:03:56 2008 for libtonc by  doxygen 1.5.3