From a1b95e9ccf9bd7b316adf21952e43e03f2bf3746 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Tue, 19 Nov 2024 17:52:36 +1300 Subject: 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 --- arm9/source/main.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'arm9/source/main.c') diff --git a/arm9/source/main.c b/arm9/source/main.c index a8d3273..8bb78d8 100644 --- a/arm9/source/main.c +++ b/arm9/source/main.c @@ -6,18 +6,20 @@ #include "devices/screen.h" #include "bang.h" #include "core.h" -#include "main_debug.h" -Bedrock br[5] = {}; +#define NUM_BR 5 + +Bedrock br[NUM_BR] = {}; Bedrock *br_main; Bedrock *br_sub; bool main_on_bottom = TRUE; + u8 main_program[] = { - #include "../include/sysinfo.br.inc" + #include "../include/cobalt.br.inc" }; u8 keyboard_program[] = { - #include "../include/sysinfo.br.inc" + 00 //#include "../include/sysinfo.br.inc" }; // Change to the next screen layout. @@ -33,18 +35,6 @@ void receive_input(void) { } -void run_br(Bedrock *br) { - if (br->awake) { - switch (evaluate(br, 1000)) { - case SIG_HALT: br->alive = FALSE; black_screen(br->scr.nds); br = NULL; return; - case SIG_SLEEP: br->awake = FALSE; return; - case SIG_DB1: debug_stacks(br); return; - case SIG_DB4: debug_assert(br); return; - default: return; - } - } -} - Screen scr_main = { .bgv = BG_TILE_RAM(BG_SLOT_VIS), .fgv = BG_TILE_RAM(FG_SLOT_VIS), @@ -67,6 +57,11 @@ int main(void) { #define AWAKE(br) (br && br->alive && br->awake) #define ASLEEP(br) (br && br->alive && !br->awake) + // Set memory identifiers. + for (int i=0; i