From f1f16d4fc2cb7540e072d199c2e85b812b17c53d Mon Sep 17 00:00:00 2001 From: tomcw Date: Mon, 6 Jul 2020 20:52:31 +0100 Subject: [PATCH] Minor tweaks for previous Base64A merge: . added dedicated IsCopamBase64A() function . added comments to identify Copam Base64A specific vars . added some missing const keywords --- source/Common.h | 5 +++++ source/Memory.cpp | 27 +++++++++++++-------------- source/NTSC_CharSet.cpp | 2 +- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/source/Common.h b/source/Common.h index 2fca260a..56b32877 100644 --- a/source/Common.h +++ b/source/Common.h @@ -236,6 +236,11 @@ inline bool IsEnhancedIIEorIIC(void) return ( (g_Apple2Type == A2TYPE_APPLE2EENHANCED) || (g_Apple2Type == A2TYPE_TK30002E) || IS_APPLE2C() ); } +inline bool IsCopamBase64A(eApple2Type type) // Copam Base64A +{ + return type == A2TYPE_BASE64A; +} + enum eBUTTON {BUTTON0=0, BUTTON1}; enum eBUTTONSTATE {BUTTON_UP=0, BUTTON_DOWN}; diff --git a/source/Memory.cpp b/source/Memory.cpp index a3ab1e8d..f3e89d42 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -77,8 +77,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #define SW_INTCXROM (memmode & MF_INTCXROM) #define SW_WRITERAM (memmode & MF_WRITERAM) #define SW_IOUDIS (memmode & MF_IOUDIS) -#define SW_ALTROM0 (memmode & MF_ALTROM0) -#define SW_ALTROM1 (memmode & MF_ALTROM1) +#define SW_ALTROM0 (memmode & MF_ALTROM0) // For Copam Base64A +#define SW_ALTROM1 (memmode & MF_ALTROM1) // For Copam Base64A /* MEMORY MANAGEMENT SOFT SWITCHES @@ -243,7 +243,7 @@ const UINT Apple2RomSize = 12 * 1024; const UINT Apple2eRomSize = Apple2RomSize + CxRomSize; //const UINT Pravets82RomSize = 12*1024; //const UINT Pravets8ARomSize = Pravets82RomSize+CxRomSize; -const UINT MaxRomPages = 4; +const UINT MaxRomPages = 4; // For Copam Base64A const UINT Base64ARomSize = MaxRomPages * Apple2RomSize; // Called from MemLoadSnapshot() @@ -705,18 +705,14 @@ BYTE __stdcall IO_Annunciator(WORD programcounter, WORD address, BYTE write, BYT g_Annunciator[(address>>1) & 3] = (address&1) ? true : false; if (address >= 0xC058 && address <= 0xC05B) - { JoyportControl(address & 0x3); // AN0 and AN1 control - } + + if (address >= 0xC058 && address <= 0xC05B && IsCopamBase64A(GetApple2Type())) + MemSetPaging(programcounter, address, write, value, nExecutedCycles); if (address >= 0xC05C && address <= 0xC05D && IsApple2JPlus(GetApple2Type())) NTSC_VideoInitAppleType(); // AN2 switches between Katakana & ASCII video rom chars (GH#773) - if (address >= 0xC058 && address <= 0xC05B && (g_Apple2Type == A2TYPE_BASE64A)) - { - MemSetPaging(programcounter, address, write, value, nExecutedCycles); - } - if (!write) return MemReadFloatingBus(nExecutedCycles); else @@ -1150,11 +1146,14 @@ static void UpdatePaging(BOOL initialize) : pCxRomInternal+uRomOffset; // C800..CFFF - Internal ROM } - int selectedrompage = (SW_ALTROM0 ? 1 : 0) | (SW_ALTROM1 ? 2 : 0); - int romoffset = (selectedrompage % memrompages) * Apple2RomSize; + const int selectedrompage = (SW_ALTROM0 ? 1 : 0) | (SW_ALTROM1 ? 2 : 0); +#ifdef _DEBUG + if (selectedrompage) { _ASSERT(IsCopamBase64A(GetApple2Type())); } +#endif + const int romoffset = (selectedrompage % memrompages) * Apple2RomSize; // Only Copam Base64A has a non-zero romoffset for (loop = 0xD0; loop < 0xE0; loop++) { - int bankoffset = (SW_BANK2 ? 0 : 0x1000); + const int bankoffset = (SW_BANK2 ? 0 : 0x1000); memshadow[loop] = SW_HIGHRAM ? SW_ALTZP ? memaux+(loop << 8)-bankoffset : g_pMemMainLanguageCard+((loop-0xC0)<<8)-bankoffset : memrom+((loop-0xD0) * 0x100)+romoffset; @@ -2062,7 +2061,7 @@ BYTE __stdcall MemSetPaging(WORD programcounter, WORD address, BYTE write, BYTE } } - if (g_Apple2Type == A2TYPE_BASE64A) + if (IsCopamBase64A(GetApple2Type())) { switch (address) { diff --git a/source/NTSC_CharSet.cpp b/source/NTSC_CharSet.cpp index 092049da..2c8d1eb7 100644 --- a/source/NTSC_CharSet.cpp +++ b/source/NTSC_CharSet.cpp @@ -181,7 +181,7 @@ static void userVideoRomForIIe(void) //------------------------------------- -static void userVideoRom2K(csbits_t csbits, const BYTE* pVideoRom, eApple2Type type = A2TYPE_APPLE2, const int AN2=0); +static void userVideoRom2K(csbits_t csbits, const BYTE* pVideoRom, const eApple2Type type = A2TYPE_APPLE2, const int AN2=0); static void userVideoRom2K(csbits_t csbits, const BYTE* pVideoRom, const eApple2Type type /*= A2TYPE_APPLE2*/, const int AN2/*=0*/) {