diff options
author | Ben Bridle <ben@derelict.engineering> | 2024-11-19 17:52:36 +1300 |
---|---|---|
committer | Ben Bridle <ben@derelict.engineering> | 2024-11-19 17:52:36 +1300 |
commit | a1b95e9ccf9bd7b316adf21952e43e03f2bf3746 (patch) | |
tree | 7bcc8d28f3de0f222c23e23c79ce15d400bee8d0 /arm9/source/debug.c | |
parent | 008b816edbd4e241975822f8b7d8765a869fa404 (diff) | |
download | bedrock-nds-a1b95e9ccf9bd7b316adf21952e43e03f2bf3746.zip |
Implement memory device
The memory device is fully implemented, with 3MB of heap memory.
This commit is a bit messy, additional changes are:
- The program memory and program counter in each Bedrock struct have
been moved to a dedicated struct to prevent a name collision with the
memory device
- The run_bg and debug functions have been moved to core.c and debug.c
- The blank screen colour has been changed back to black
- No second program runs on the sub screen by default
- The number of Bedrock instances to run has been parameterized
Diffstat (limited to 'arm9/source/debug.c')
-rw-r--r-- | arm9/source/debug.c | 24 |
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"); + } +} |