Main Page   Modules   Data Structures   File List   Globals  

msh_debug.h File Reference

Debug functions. More...


Defines

#define assert(cond, msg)   ;
#define dprint(str)   print_mappy(str);
#define dprintf()   {sprintf(_dbg_string, __VA_ARGS__); dprint(_dbg_string);}
#define dtext(x, y,)   {sprintf(_dbg_string, __VA_ARGS__); _dtext(x, y, _dbg_string);}
#define prf_start()   PRF_START()
#define prf_end()   PRF_END()
#define get_prf_total()   GET_PRF_TOTAL()
#define get_prf_lines()   GET_PRF_LINES()
#define prf_print(msg)   PRF_PRINT(msg)
#define prf_text(x, y)   PRF_TEXT(x, y)

Functions

void print_vba_thb (char *msg)
void print_vba_arm (char *msg)
void print_mappy (const char *msg)
void set_dtext_mapdata (void *mapdata)
void set_dtext_pal (u8 pal)
void set_dtext_fontmap (char *fontmap)
void set_dtext_tile_offset (u16 tile_offset)
void set_dtext_mapwidth (u16 mapwidth)
void * get_dtext_mapdata ()
u8 get_dtext_pal ()
char * get_dtext_fontmap ()
u16 get_dtext_tile_offset ()
u16 get_dtext_mapwidth ()
void dtext_init (u8 mapbase, u16 mapwidth, u8 pal, u16 tile_offset)
u32 get_ewram_avail ()
void hexdump (void *addr, u32 length)
void bitdump (void *addr, u32 length)


Detailed Description


Define Documentation

#define assert cond,
msg       ;
 

Parameters:
cond  True/False Condition
msg  Message to display
Displays a message if the specified condition fails

#define dprint str       print_mappy(str);
 

Parameters:
str  String
Used for writing debug text to the console

 
#define dprintf      {sprintf(_dbg_string, __VA_ARGS__); dprint(_dbg_string);}
 

Parameters:
...  Format string
Used for writing debug text to the console

#define dtext x,
     {sprintf(_dbg_string, __VA_ARGS__); _dtext(x, y, _dbg_string);}
 

Parameters:
x  u16 X Position
y  u16 Y Position
...  Format string
Used for writing debug text onto a virtual map or BG map

 
#define PRF_START  
 

Value:

{set_timer_cnt(MSH_PRF_TIMER, 0); \
    set_timer_data(MSH_PRF_TIMER, 0); \
    set_timer_cnt(MSH_PRF_TIMER, TIM_FREQ_1024 | TIM_ENABLE);}

 
#define prf_start      PRF_START()
 

Start a profiling block. Used to time functions.

 
#define prf_end      PRF_END()
 

End a profiling block. Stop timing.

 
#define get_prf_total      GET_PRF_TOTAL()
 

Returns:
u16 Number of ticks
Returns the number of ticks elapsed between calling prf_start() and prf_end().

 
#define get_prf_lines      GET_PRF_LINES()
 

Returns:
u16 Number of scanlines
Returns the number of scanlines elapsed between calling prf_start() and prf_end(). This function is helpful to check if certain functions will fit within the VBlank period.

This function provides an approximation of scanlines elapsed and will sometimes report an extra scanline.

#define prf_print msg       PRF_PRINT(msg)
 

Parameters:
msg  char* Message String
Prints out the profile results to the console. You can also enter your own message so you can make notes of what is being profiled.

#define prf_text x,
     PRF_TEXT(x, y)
 

Parameters:
x  u16 X Location
y  u16 Y Location
Prints out the profile results to the GBA screen


Function Documentation

void print_vba_thb char *    msg
 

Parameters:
msg  Message String
Prints a message to the console under VisualBoyAdvance.

void print_vba_arm char *    msg
 

Parameters:
msg  Message String
Prints a message to the console under VisualBoyAdvance.

void print_mappy const char *    msg
 

Parameters:
msg  Message String
Prints a message to the console under Mappy or VisualBoyAdvance.

void set_dtext_mapdata void *    mapdata
 

Parameters:
mapdata  Pointer to map data
Use the BG_MAPBASE() macro if you want to write to BG MEM.

Example:
Sets dtext() to write to mapbase 31 of BG MEM.

  set_dtext_mapdata((void *)BG_MAPBASE(31));

void set_dtext_pal u8    pal
 

Parameters:
pal  [0..15] Palette

void set_dtext_fontmap char *    fontmap
 

Parameters:
fontmap  Array mapping font tiles to ASCII

void set_dtext_tile_offset u16    tile_offset
 

Parameters:
tile_offset  The starting tile in VRAM of the font tileset

void set_dtext_mapwidth u16    mapwidth
 

Parameters:
mapwidth  Map Width

void* get_dtext_mapdata  
 

Returns:
Pointer to map data

u8 get_dtext_pal  
 

Returns:
[0..15] Palette

char* get_dtext_fontmap  
 

Returns:
Array mapping font tiles to ASCII

u16 get_dtext_tile_offset  
 

Returns:
The starting tile in VRAM of the font tileset

u16 get_dtext_mapwidth  
 

Returns:
Map Width

void dtext_init u8    mapbase,
u16    mapwidth,
u8    pal,
u16    tile_offset
 

Parameters:
mapbase  [0..31] Map base
mapwidth  Map Width
pal  [0..15] Palette
tile_offset  The starting tile in VRAM of the font tileset
Sets 2 colors in the palette you choose and loads the default font. Call this function before using dtext() or set the dtext() values manually.

u32 get_ewram_avail  
 

Returns:
EWRAM Bytes Free
Returns the largest free block of EWRAM

void hexdump void *    addr,
u32    length
 

Parameters:
addr  Start Address
length  Length (in bytes)
Performs a hex dump of memory from the start address to the console

void bitdump void *    addr,
u32    length
 

Parameters:
addr  Start Address
length  Length (in bytes)
Performs a bit dump of memory from the start address to the console


Generated on Wed May 19 21:45:08 2004 for Mushroom GBALib by doxygen 1.2.18