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/main.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/main.c')
-rw-r--r-- | arm9/source/main.c | 27 |
1 files changed, 11 insertions, 16 deletions
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<NUM_BR; i++) { + br[i].mem.id = i+1; + } + init_screens(); init_clock(); lcdMainOnBottom(); |