GBDK 2020 Docs
API Documentation for GBDK 2020
|
Go to the source code of this file.
Macros | |
#define | BGB_MESSAGE(message_text) BGB_MESSAGE1(BGB_ADD_DOLLARD(__LINE__), message_text) |
#define | BGB_MESSAGE_FMT(buf, ...) sprintf(buf, __VA_ARGS__);BGB_MESSAGE2(BGB_ADD_DOLLARD(__LINE__), BGB_MAKE_LABEL(_##buf)); |
#define | BGB_PROFILE_BEGIN(MSG) BGB_MESSAGE(BGB_CONCAT(MSG,%ZEROCLKS%)); |
#define | BGB_PROFILE_END(MSG) BGB_MESSAGE(BGB_CONCAT(MSG,%-8+LASTCLKS%)); |
#define | BGB_TEXT(MSG) BGB_MESSAGE(BGB_STR(MSG)) |
Functions | |
void | BGB_profiler_message () |
Debug window logging and profiling support for the BGB emulator.
Also see the bgb_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 BGB_MESSAGE | ( | message_text | ) | BGB_MESSAGE1(BGB_ADD_DOLLARD(__LINE__), message_text) |
Macro to display a message in the BGB 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_FMT | ( | buf, | |
... | |||
) | sprintf(buf, __VA_ARGS__);BGB_MESSAGE2(BGB_ADD_DOLLARD(__LINE__), BGB_MAKE_LABEL(_##buf)); |
Macro to display a sprintf formatted message in the BGB emulator debug message window
buf | Pointer to a globally defined char buffer |
... | VA Args list of sprintf parameters |
To avoid buffer overflows buf must be large enough to store the entire printed message.
Example:
#define BGB_PROFILE_BEGIN | ( | MSG | ) | BGB_MESSAGE(BGB_CONCAT(MSG,%ZEROCLKS%)); |
Macro to Start a profiling block for the BGB emulator
MSG | Quoted text string to display in the debug message window |
To complete the profiling block and print the result call BGB_PROFILE_END.
#define BGB_PROFILE_END | ( | MSG | ) | BGB_MESSAGE(BGB_CONCAT(MSG,%-8+LASTCLKS%)); |
Macro to End a profiling block and print the results in the BGB 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 BGB_PROFILE_BEGIN()
The results are in BGB 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 | ) | BGB_MESSAGE(BGB_STR(MSG)) |
void BGB_profiler_message | ( | ) |
Display preset debug information in the BGB debug messages window.
This function is equivalent to: