GBDK 2020 Docs
4.1.1
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_TEXT(MSG) EMU_MESSAGE(MSG) |
#define | BGB_TEXT(MSG) EMU_TEXT(MSG) |
#define | BGB_printf(...) EMU_printf(__VA_ARGS__) |
#define | EMU_BREAKPOINT __asm__("ld b, b"); |
#define | BGB_BREAKPOINT EMU_BREAKPOINT |
Functions | |
void | EMU_printf (const char *format,...) OLDCALL |
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_TEXT | ( | MSG | ) | EMU_MESSAGE(MSG) |
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_TEXT | ( | MSG | ) | EMU_TEXT(MSG) |
#define BGB_printf | ( | ... | ) | EMU_printf(__VA_ARGS__) |
The Emulator will break into debugger when encounters this line
#define BGB_BREAKPOINT EMU_BREAKPOINT |
void EMU_printf | ( | const char * | format, |
... | |||
) |
Display preset debug information in the Emulator debug messages window.
This function is equivalent to:
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. Result string MUST BE LESS OR EQUAL THAN 128 BYTES LONG, INCLUDING THE TRAILIG ZERO BYTE!
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.