GBDK 2020 Docs
API Documentation for GBDK 2020
bgb_emu.h
Go to the documentation of this file.
1 
12 #ifndef __BGB_EMU_INCLUDE
13 #define __BGB_EMU_INCLUDE
14 
16 #define BGB_ADD_DOLLARD(A) BGB_ADD_DOLLARD1 (A)
17 #define BGB_ADD_DOLLARD1(A) A##00$
18 
43 #define BGB_MESSAGE(message_text) BGB_MESSAGE1(BGB_ADD_DOLLARD(__LINE__), message_text)
44 #define BGB_MESSAGE1(lbl, message_text) \
46 __asm \
47  ld d, d \
48  jr lbl \
49  .dw 0x6464 \
50  .dw 0x0000 \
51  .ascii message_text \
52 lbl: \
53 __endasm
54 
55 #define BGB_HASH #
56 #define BGB_ADD_HASH(x) x
57 #define BGB_MAKE_LABEL(a) BGB_ADD_HASH(BGB_HASH)a
58 
77 #define BGB_MESSAGE_FMT(buf, ...) sprintf(buf, __VA_ARGS__);BGB_MESSAGE2(BGB_ADD_DOLLARD(__LINE__), BGB_MAKE_LABEL(_##buf));
78 #define BGB_MESSAGE2(lbl, buf) \
80 __asm \
81  ld d, d \
82  jr lbl \
83  .dw 0x6464 \
84  .dw 0x0001 \
85  .dw buf \
86  .dw 0 \
87 lbl: \
88 __endasm
89 
90 #define BGB_STR(A) #A
91 #define BGB_CONCAT(A,B) BGB_STR(A:B)
92 
103 #define BGB_PROFILE_BEGIN(MSG) BGB_MESSAGE(BGB_CONCAT(MSG,%ZEROCLKS%));
104 
129 #define BGB_PROFILE_END(MSG) BGB_MESSAGE(BGB_CONCAT(MSG,%-8+LASTCLKS%));
130 #define BGB_TEXT(MSG) BGB_MESSAGE(BGB_STR(MSG))
131 
141 
142 static void * __BGB_PROFILER_INIT = &BGB_profiler_message;
143 
144 #endif
BGB_profiler_message
void BGB_profiler_message()