45cc06723d6daeeea6d6aad6e68ac34cc6d9dcc3
[gbajam21] / src / debug.h
1 #ifndef DEBUG_H_
2 #define DEBUG_H_
3
4 #include <stdarg.h>
5 #include "util.h"
6
7 extern unsigned char font_8x8[];
8
9 extern uint16_t vblperf_color[];
10 uint16_t *vblperf_palptr;
11 volatile int vblperf_count;
12
13 void vblperf_setcolor(int palidx);
14
15 #define vblperf_begin() \
16         do { \
17                 *vblperf_palptr = 0; \
18                 vblperf_count = 0; \
19         } while(0)
20
21 #define vblperf_end() \
22         do { \
23                 *vblperf_palptr = vblperf_color[vblperf_count]; \
24         } while(0)
25
26
27 void panic(void *pc, const char *fmt, ...) __attribute__((noreturn));
28
29 void dbg_drawglyph(int x, int y, int c);
30 int dbg_drawstr(int x, int y, const char *fmt, ...);
31 int dbg_vdrawstr(int x, int y, const char *fmt, va_list ap);
32
33 void emuprint(const char *fmt, ...);
34
35 #endif  /* DEBUG_H_ */