From 27e352727b84e9275060a6d8f643e03cb493adeb Mon Sep 17 00:00:00 2001 From: Peter Weingartner Date: Fri, 15 Nov 2024 19:54:44 -0500 Subject: [PATCH] Moved boot sprites and tiles to the top of RAM --- src/boot.c | 11 +++++++++++ src/dev/sprites.c | 2 +- src/dev/sprites.h | 2 ++ src/dev/tiles.c | 4 ++-- src/dev/tiles.h | 3 +++ src/memory.c | 7 +++++-- src/memory.h | 5 ++--- src/toolbox.c | 2 +- src/version.h | 2 +- 9 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/boot.c b/src/boot.c index 4d3aaa7..ddc5717 100644 --- a/src/boot.c +++ b/src/boot.c @@ -442,6 +442,17 @@ void boot_screen() { long jiffies_target = 0; char message[80]; + // Locate the tile maps based on the top of ram + uint32_t ram_index = mem_get_ramtop(); + ram_index -= 8 * 272; + tile_set_memory_base = ram_index; + ram_index -= 2 * 42 * 32; + tile_map_memory_base = ram_index; + + // Locate the sprites + ram_index -= 5 * (32 * 32); + sprite_ram_base = ram_index; + // Check the DIP switches to see if we should include RAM booting // Choose the correct boot chain accordingly diff --git a/src/dev/sprites.c b/src/dev/sprites.c index fa9d416..ca3739f 100644 --- a/src/dev/sprites.c +++ b/src/dev/sprites.c @@ -19,7 +19,7 @@ static t_sprite sprite_shadow[SPRITE_MAX]; -const uint32_t sprite_ram_base = 0x000000; +uint32_t sprite_ram_base = 0x000000; /** * @brief Update a sprite's hardware registers from the shadow registers diff --git a/src/dev/sprites.h b/src/dev/sprites.h index 2a2d915..cb78150 100644 --- a/src/dev/sprites.h +++ b/src/dev/sprites.h @@ -15,6 +15,8 @@ #include #include +extern uint32_t sprite_ram_base; + /** * @brief Set the basic information about the sprite * diff --git a/src/dev/tiles.c b/src/dev/tiles.c index b11bb7c..d36df38 100644 --- a/src/dev/tiles.c +++ b/src/dev/tiles.c @@ -7,8 +7,8 @@ static t_tile_set tile_set_shadow[VKY_TILESET_MAX]; static t_tile_map tile_map_shadow[VKY_TILEMAP_MAX]; -const uint32_t tile_set_memory_base = 0x002000; -const uint32_t tile_map_memory_base = 0x003000; +uint32_t tile_set_memory_base = 0x002000; +uint32_t tile_map_memory_base = 0x003000; /** * @brief Setup a tile set diff --git a/src/dev/tiles.h b/src/dev/tiles.h index 03c50da..c5c612a 100644 --- a/src/dev/tiles.h +++ b/src/dev/tiles.h @@ -15,6 +15,9 @@ #include #include +extern uint32_t tile_set_memory_base; +extern uint32_t tile_map_memory_base; + /** * @brief Setup a tile set * diff --git a/src/memory.c b/src/memory.c index e7cc5db..0ee6a4e 100644 --- a/src/memory.c +++ b/src/memory.c @@ -13,6 +13,7 @@ */ #include "memory.h" +#include "sys_general.h" unsigned long mem_top_of_ram = 0; @@ -21,8 +22,10 @@ unsigned long mem_top_of_ram = 0; * * @param top_of_ram initial value for the top of system RAM */ -void mem_init(unsigned long top_of_ram) { - mem_top_of_ram = top_of_ram; +void mem_init() { +#if MODEL == MODEL_FOENIX_F256 || MODEL == MODEL_FOENIX_F256K || MODEL == MODEL_FOENIX_F256K2 + mem_top_of_ram = 0x06ffff; +#endif } /** diff --git a/src/memory.h b/src/memory.h index 74f2a01..5a42d31 100644 --- a/src/memory.h +++ b/src/memory.h @@ -17,12 +17,11 @@ #include "sys_macros.h" -/* +/** * Initialize the memory management system * - * @param top_of_ram initial value for the top of system RAM */ -extern void mem_init(unsigned long top_of_ram); +extern void mem_init(); /** * Return the top of system RAM... the user program must not use any diff --git a/src/toolbox.c b/src/toolbox.c index 9a51261..b2d55d1 100644 --- a/src/toolbox.c +++ b/src/toolbox.c @@ -90,7 +90,7 @@ void initialize() { sys_get_information(&info); /* Initialize the memory system */ - mem_init(0x3d0000); + mem_init(); // /* Hide the mouse */ // mouse_set_visible(0); diff --git a/src/version.h b/src/version.h index 4844a44..bedcf0a 100644 --- a/src/version.h +++ b/src/version.h @@ -7,6 +7,6 @@ #define VER_MAJOR 1 #define VER_MINOR 0 -#define VER_BUILD 38 +#define VER_BUILD 39 #endif