polygon filler, rudimentary GL
[gba_blender] / src / debug.c
diff --git a/src/debug.c b/src/debug.c
new file mode 100644 (file)
index 0000000..d24af0a
--- /dev/null
@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <stdarg.h>
+#include "debug.h"
+
+__attribute__((target("arm")))
+void emuprint(const char *fmt, ...)
+{
+       char buf[128];
+       va_list arg_list;
+
+       va_start(arg_list, fmt);
+       vsnprintf(buf, 128, fmt, arg_list);
+       va_end(arg_list);
+
+       __asm__ __volatile__(
+               "mov r0, %0\n\t"
+               "swi 0xff0000\n\t" :
+               : "r" (buf)
+               : "r0"
+       );
+}