# GBDK 2020 Docs: gb/emu_debug.h Source File

emu_debug.h
Go to the documentation of this file.
#ifndef __EMU_DEBUG_INCLUDE
#define __EMU_DEBUG_INCLUDE
#include <types.h>
#define EMU_MESSAGE(message_text) EMU_MESSAGE1(EMU_MACRONAME(__LINE__), message_text)
#define BGB_MESSAGE(message_text) EMU_MESSAGE(message_text)
#define EMU_MACRONAME(A) EMU_MACRONAME1(A)
#define EMU_MACRONAME1(A) EMULOG##A
#define EMU_MESSAGE1(name, message_text) \
__asm \
.MACRO name msg_t, ?llbl\
ld d, d \
jr llbl \
.dw 0x6464 \
.dw 0x0000 \
.ascii msg_t \
llbl: \
.ENDM \
name ^/message_text/ \
__endasm
#define EMU_MESSAGE_SUFFIX(message_text, message_suffix) EMU_MESSAGE3(EMU_MACRONAME(__LINE__), message_text, message_suffix)
#define EMU_MESSAGE3(name, message_text, message_suffix) \
__asm \
.MACRO name msg_t, msg_s, ?llbl\
ld d, d \
jr llbl \
.dw 0x6464 \
.dw 0x0000 \
.ascii msg_t \
.ascii msg_s \
llbl: \
.ENDM \
name ^/message_text/, ^/message_suffix/ \
__endasm
#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)
void EMU_profiler_message();
#define BGB_profiler_message() EMU_profiler_message()
void EMU_printf(const char *format, ...) OLDCALL;
#define BGB_printf(...) EMU_printf(__VA_ARGS__)
static void * __EMU_PROFILER_INIT = &EMU_profiler_message;
#define EMU_BREAKPOINT __asm__("ld b, b");
#define BGB_BREAKPOINT EMU_BREAKPOINT
#endif
EMU_printf
void EMU_printf(const char *format,...) OLDCALL
EMU_profiler_message
void EMU_profiler_message()
OLDCALL
#define OLDCALL
Definition: types.h:19