diff --git a/include/experimental/debug.h b/include/experimental/debug.h index b821d3a..1f551c2 100644 --- a/include/experimental/debug.h +++ b/include/experimental/debug.h @@ -3,4 +3,46 @@ #define BREAKPOINT __asm jr $ __endasm; -#endif \ No newline at end of file +#include +#include + +#define __DEFAULT_DEBUG_TIMEOUT 150 + +#ifndef KCC_DISABLE_DEBUG + +#define debug_hinted(/* SCREEN* */ screen, msg, /* char* */ hint, /* int */ timeout, /* void(SCREEN*, unsigned char, unsigned char, msg) */ draw_func) \ +{ \ + unsigned short i = 0; \ + const unsigned char* bug_msg = hint; \ + const unsigned short bug_msg_len = strlen(bug_msg); \ + const unsigned short space = (bug_msg_len != 0) ? 4 : 0; \ + screen_clear(screen); \ + draw_string(screen, 2, 2, "L. "); \ + draw_short(screen, 2+3*4, 2, __LINE__); \ + draw_string(screen, 2, 8*7, __FILE__); \ + draw_string(screen, 2, 8*1, hint);\ + /* the size of a single character is 4 pixel */ \ + draw_func(screen, 2+bug_msg_len*4+space, 8*1, msg); \ + for(i=0; i