14e00c0d3c328210113822d1779c08ee8aeaa6e4
[gbajam21] / src / debug.c
1 #include <stdio.h>
2 #include <stdarg.h>
3 #include "debug.h"
4
5 #ifdef EMUBUILD
6 __attribute__((target("arm")))
7 void emuprint(const char *fmt, ...)
8 {
9         char buf[128];
10         va_list arg_list;
11
12         va_start(arg_list, fmt);
13         vsnprintf(buf, 128, fmt, arg_list);
14         va_end(arg_list);
15
16         __asm__ __volatile__(
17                 "mov r0, %0\n\t"
18                 "swi 0xff0000\n\t" :
19                 : "r" (buf)
20                 : "r0"
21         );
22 }
23 #else
24 void emuprint(const char *fmt, ...)
25 {
26 }
27 #endif