summaryrefslogtreecommitdiff
path: root/arm9/source/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'arm9/source/debug.c')
-rw-r--r--arm9/source/debug.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arm9/source/debug.c b/arm9/source/debug.c
new file mode 100644
index 0000000..eae5192
--- /dev/null
+++ b/arm9/source/debug.c
@@ -0,0 +1,24 @@
+#include <nds.h>
+#include "core.h"
+
+void debug_stacks(Bedrock *br) {
+ u8 i;
+ printf("\nP:0x%04x I:0x%02x", PC, MEM[PC]);
+ printf("\nW:");
+ for (i=0; i<WST.p; i++) {
+ printf("%02x ", WST.mem[i]);
+ }
+ printf("\nR:");
+ for (i=0; i<RST.p; i++) {
+ printf("%02x ", RST.mem[i]);
+ }
+ printf("\n");
+}
+
+void debug_assert(Bedrock *br) {
+ if (WST.mem[0] == 0xff && WST.p == 1 && RST.p == 0) {
+ printf(".");
+ } else {
+ printf("X");
+ }
+}