diff options
author | Ben Bridle <ben@derelict.engineering> | 2024-11-18 14:57:19 +1300 |
---|---|---|
committer | Ben Bridle <ben@derelict.engineering> | 2024-11-18 14:57:19 +1300 |
commit | 722d5509178fa5bdaa488fbbd9196f21377f8775 (patch) | |
tree | 112b39cd80cb8e074d9e71d1def4d8de33c9eefa /arm9/source/main_debug.c | |
download | bedrock-nds-722d5509178fa5bdaa488fbbd9196f21377f8775.zip |
Initial commit
Diffstat (limited to 'arm9/source/main_debug.c')
-rw-r--r-- | arm9/source/main_debug.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/arm9/source/main_debug.c b/arm9/source/main_debug.c new file mode 100644 index 0000000..eae5192 --- /dev/null +++ b/arm9/source/main_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"); + } +} |