From 37c031c193d344f9ee3b5a7d8531b7f0272ccac8 Mon Sep 17 00:00:00 2001 From: tomcw Date: Sun, 17 Mar 2024 21:13:45 +0000 Subject: [PATCH] Update the comment about what isn't fully emulated & improve reset re-init. --- source/LanguageCard.cpp | 21 ++++++++++++++++++++- source/Memory.cpp | 18 +++++++++++++++++- source/Utilities.cpp | 1 + 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/source/LanguageCard.cpp b/source/LanguageCard.cpp index bc953830..f0da5dd6 100644 --- a/source/LanguageCard.cpp +++ b/source/LanguageCard.cpp @@ -25,9 +25,28 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: various * + * Note: Here's what isn't fully emulated: + * From UTAII 5-42 (Application Note: Multiple RAM Card Configurations) + * . For II/II, INHIBIT' (disable motherboard ROM for $D000-$FFFF) and Apple's 16K RAM card isn't correct: + * . "If the expansion RAM is not enabled on a RAM card, the ROM on the card will respond to $F800-$FFFF addressing - period." + * . In UTAIIe 5-24, Sather describes this as "a particularly nettlesome associated fact"! + * . NB. "When INHIBIT' is low on the Apple IIe, all motherboard ROM is disabled, including high RAM." + * . Note: I assume a Saturn card "will release the $F800-$FFFF range when RAM on the card is disabled", since there's no F8 ROM on the Saturn. + * . Summary: for a II/II+ with an *Apple* 16K RAM card in slot 0, when (High) RAM is disabled, then: + * . ROM on the slot 0 card will respond, along with any Saturn card(s) in other slots which pull INHIBIT' low. + * . *** AppleWin emulates a slot 0 LC as if the Sather h/w mod had been applied. + * . [UTAII 5-42] "Enable two RAM cards for writing simultaneously..." + * "both RAM cards will accept the data from a single store instruction to the $D000-$FFFF range" + * *** AppleWin only stores to the last accessed RAM card. + * . Presumably enabling two RAM cards for reading RAM will both respond and the result is the OR-sum? + * *** AppleWin only loads from the last accessed RAM card. + * . The 16K RAM card has a socket for an F8 ROM, whereas the Saturn card doesn't. + * Also see UTAII 6-6, where Firmware card and 16K RAM card are described. + * . Sather refers to the Apple 16K RAM card, which is just the Apple Language Card. * - * Consider adding a LangauageCardManager class: + * Note: Consider adding a LangauageCardManager class: * . would manage g_lastSlotToSetMainMemLC (so move out of Memory.cpp) + * . would manage reset for all cards (eg. II/II+'s LC is unaffected, whereas //e's LC is) * . assist with debugger's display of "sNN" for active 16K bank * Currently conclude that there's not much point. */ diff --git a/source/Memory.cpp b/source/Memory.cpp index 03e6dec6..5239b97a 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -1139,9 +1139,12 @@ static void UpdatePaging(BOOL initialize); // . CtrlReset() Soft-reset (Ctrl+Reset) for //e void MemResetPaging() { - ResetPaging(0); // Initialize=0 + ResetPaging(FALSE); // Initialize=0 } +// Call by: +// . MemResetPaging() -> ResetPaging(FALSE) +// . MemReset() -> ResetPaging(TRUE) static void ResetPaging(BOOL initialize) { SetLastRamWrite(0); @@ -1151,6 +1154,19 @@ static void ResetPaging(BOOL initialize) else SetMemMode(LanguageCardUnit::kMemModeInitialState); + // For power on: card's ctor will have set card's local memmode to LanguageCardUnit::kMemModeInitialState. + // For reset: II/II+ unaffected, so only for //e or above. + if (IsAppleIIeOrAbove(GetApple2Type())) + { + if (GetCardMgr().QuerySlot(SLOT0) != CT_Empty) // LC or Saturn + dynamic_cast(GetCardMgr().GetRef(SLOT0)).SetLCMemMode(GetMemMode() & MF_LANGCARD_MASK); + for (UINT i = SLOT1; i < NUM_SLOTS; i++) + { + if (GetCardMgr().QuerySlot(i) == CT_Saturn128K) + dynamic_cast(GetCardMgr().GetRef(i)).SetLCMemMode(GetMemMode() & MF_LANGCARD_MASK); + } + } + UpdatePaging(initialize); } diff --git a/source/Utilities.cpp b/source/Utilities.cpp index eab7d227..8d63eda3 100644 --- a/source/Utilities.cpp +++ b/source/Utilities.cpp @@ -549,6 +549,7 @@ void CtrlReset() if (!IS_APPLE2) { // For A][ & A][+, reset doesn't reset the LC switches (UTAII:5-29) + // TODO: What about Saturn cards? Presumably the same as the A][ & A][+ slot0 LC? MemResetPaging(); // For A][ & A][+, reset doesn't reset the video mode (UTAII:4-4)