GBDK 2020 Docs
4.3.0
API Documentation for GBDK 2020
|
#include <types.h>
Go to the source code of this file.
Macros | |
#define | EMU_MESSAGE(message_text) EMU_MESSAGE1(EMU_MACRONAME(__LINE__), message_text) |
#define | BGB_MESSAGE(message_text) EMU_MESSAGE(message_text) |
#define | EMU_PROFILE_BEGIN(MSG) EMU_MESSAGE_SUFFIX(MSG, "%ZEROCLKS%"); |
#define | BGB_PROFILE_BEGIN(MSG) EMU_PROFILE_BEGIN(MSG) |
#define | EMU_PROFILE_END(MSG) EMU_MESSAGE_SUFFIX(MSG,"%-8+LASTCLKS%"); |
#define | BGB_PROFILE_END(MSG) EMU_PROFILE_END(MSG) |
#define | EMU_TEXT(MSG) EMU_MESSAGE(MSG) |
#define | BGB_TEXT(MSG) EMU_TEXT(MSG) |
#define | BGB_profiler_message EMU_profiler_message() |
#define | BGB_printf(...) EMU_printf(__VA_ARGS__) |
#define | EMU_BREAKPOINT __asm__("ld b, b"); |
#define | BGB_BREAKPOINT EMU_BREAKPOINT |
Functions | |
void | EMU_profiler_message (void) |
void | EMU_printf (const char *format,...) PRESERVES_REGS(a |
void | EMU_fmtbuf (const unsigned char *format, void *data) PRESERVES_REGS(a |
Variables | |
void | b |
void | c |
Debug window logging and profiling support for emulators (BGB, Emulicious, etc).
Also see the emu_debug
example project included with gbdk.
See the BGB Manual for more information ("expressions, breakpoint conditions, and debug messages") http://bgb.bircd.org/manual.html#expressions
#define EMU_MESSAGE | ( | message_text | ) | EMU_MESSAGE1(EMU_MACRONAME(__LINE__), message_text) |
Macro to display a message in the emulator debug message window
message_text | Quoted text string to display in the debug message window |
The following special parameters can be used when bracketed with "%" characters.
Example: print a message along with the currently active ROM bank.
See the BGB Manual for more information ("expressions, breakpoint conditions, and debug messages") http://bgb.bircd.org/manual.html#expressions
#define BGB_MESSAGE | ( | message_text | ) | EMU_MESSAGE(message_text) |
#define EMU_PROFILE_BEGIN | ( | MSG | ) | EMU_MESSAGE_SUFFIX(MSG, "%ZEROCLKS%"); |
Macro to Start a profiling block for the emulator (BGB, Emulicious, etc)
MSG | Quoted text string to display in the debug message window along with the result |
To complete the profiling block and print the result call EMU_PROFILE_END.
#define BGB_PROFILE_BEGIN | ( | MSG | ) | EMU_PROFILE_BEGIN(MSG) |
#define EMU_PROFILE_END | ( | MSG | ) | EMU_MESSAGE_SUFFIX(MSG,"%-8+LASTCLKS%"); |
Macro to End a profiling block and print the results in the emulator debug message window
MSG | Quoted text string to display in the debug message window along with the result |
This should only be called after a previous call to EMU_PROFILE_BEGIN()
The results are in Emulator clock units, which are "1 nop in [CGB] doublespeed mode".
So when running in Normal Speed mode (i.e. non-CGB doublespeed) the printed result should be divided by 2 to get the actual ellapsed cycle count.
If running in CB Double Speed mode use the below call instead, it correctly compensates for the speed difference. In this scenario, the result does not need to be divided by 2 to get the ellapsed cycle count.
#define BGB_PROFILE_END | ( | MSG | ) | EMU_PROFILE_END(MSG) |
#define EMU_TEXT | ( | MSG | ) | EMU_MESSAGE(MSG) |
#define BGB_TEXT | ( | MSG | ) | EMU_TEXT(MSG) |
#define BGB_profiler_message EMU_profiler_message() |
#define BGB_printf | ( | ... | ) | EMU_printf(__VA_ARGS__) |
The Emulator will break into debugger when encounters this line
#define BGB_BREAKPOINT EMU_BREAKPOINT |
void EMU_profiler_message | ( | void | ) |
Display preset debug information in the Emulator debug messages window.
This function is equivalent to:
void EMU_printf | ( | const char * | format, |
... | |||
) |
Print the string and arguments given by format to the emulator debug message window
format | The format string as per printf |
Does not return the number of characters printed. Currently supported:
Warning: to correctly pass chars for printing as chars, they must be explicitly re-cast as such when calling the function. See docs_chars_varargs for more details.
Currently supported in the Emulicious emulator
void EMU_fmtbuf | ( | const unsigned char * | format, |
void * | data | ||
) |
Print the string and arguments in the buffer buffer by the pointer given by format to the emulator debug message window
format | The format string as per printf |
data | Buffer containing arguments, for example some struct |
Currently supported in the Emulicious emulator
void b |
void c |