From 3d2891e9b65f59a578968b24396b7e61d2d0abf5 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 4 Dec 2022 21:19:13 +0200 Subject: [PATCH] Store highest RAM address --- include/memory.h | 1 + memory.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/memory.h b/include/memory.h index 71e1ae63..601b696b 100644 --- a/include/memory.h +++ b/include/memory.h @@ -28,6 +28,7 @@ void free_shm (void); bool preinit_shm (void); extern bool canbang; extern bool jit_direct_compatible_memory; +extern uaecptr highest_ram; #define Z3BASE_UAE 0x10000000 #define Z3BASE_REAL 0x40000000 diff --git a/memory.cpp b/memory.cpp index 3b4cf78a..916782da 100644 --- a/memory.cpp +++ b/memory.cpp @@ -44,6 +44,7 @@ #include "casablanca.h" bool canbang; +uaecptr highest_ram; static bool rom_write_enabled; #ifdef JIT /* Set by each memory handler that does not simply access real memory. */ @@ -2789,6 +2790,7 @@ void memory_reset (void) int bnk, bnk_end; bool gayleorfatgary; + highest_ram = 0; alg_flag = 0; need_hardreset = false; rom_write_enabled = true; @@ -3401,6 +3403,9 @@ void map_banks (addrbank *bank, int start, int size, int realsize) #ifdef WITH_PPC ppc_generate_map_banks(bank, start, size); #endif + if ((bank->flags & ABFLAG_RAM) && !(bank->flags & ABFLAG_RTG) && ((start + size) << 16) > highest_ram) { + highest_ram = (start + size) << 16; + } } bool validate_banks_z3(addrbank *bank, int start, int size) -- 2.47.3