From 2fb9b7c0e49fee644b09ca90d742485a6612a0ba Mon Sep 17 00:00:00 2001 From: ksherlock Date: Fri, 26 May 2023 13:28:35 -0400 Subject: apple/apple2gs: Fix ROM0/1 ram size logic (#11264) * 256k (ROM 0/1) apple2gs doesn't have any extra memory above the base 4 banks --- src/mame/apple/apple2gs.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/mame/apple/apple2gs.cpp b/src/mame/apple/apple2gs.cpp index d8278ba9017..96d4be36443 100644 --- a/src/mame/apple/apple2gs.cpp +++ b/src/mame/apple/apple2gs.cpp @@ -727,12 +727,24 @@ void apple2gs_state::machine_start() m_inh_slot = -1; m_cnxx_slot = CNXX_UNCLAIMED; - // install memory beyond 256K/1M - address_space& space = m_maincpu->space(AS_PROGRAM); - int ramsize = m_ram_size - 0x20000; // subtract 128K for banks 0 and 1, which are handled specially - // RAM sizes for both classes of machine no longer include the Mega II RAM - space.install_ram(0x020000, ramsize - 1 + 0x20000, m_ram_ptr + 0x020000); + // install memory beyond 256K + int ramsize = m_ram_size; + if (!m_is_rom3 && m_ram_size <= 1280 * 1024) + { + ramsize -= 0x40000; // subtract 256k for banks 0, 1, e0, e1 + } + else if (m_is_rom3 || m_ram_size == 1024 * 1024 * 8) + { + ramsize -= 0x20000; // subtract 128K for banks 0 and 1, which are handled specially + } + + if (ramsize) + { + address_space& space = m_maincpu->space(AS_PROGRAM); + // RAM sizes for both classes of machine no longer include the Mega II RAM + space.install_ram(0x020000, ramsize - 1 + 0x20000, m_ram_ptr + 0x020000); + } // setup save states save_item(NAME(m_speaker_state)); -- cgit v1.2.3