From 6ffa1e54ef5628e4c7f786951f4acbcc81d8250a Mon Sep 17 00:00:00 2001 From: tomch Date: Sun, 10 Mar 2013 23:44:30 +0000 Subject: [PATCH] Fix bug #18886: MMU issue --- AppleWin/docs/History.txt | 6 +-- AppleWin/source/Debugger/Debug.cpp | 4 +- AppleWin/source/Memory.cpp | 77 ++++++++++++++++++++++-------- 3 files changed, 63 insertions(+), 24 deletions(-) diff --git a/AppleWin/docs/History.txt b/AppleWin/docs/History.txt index f41367c6..28071fb3 100644 --- a/AppleWin/docs/History.txt +++ b/AppleWin/docs/History.txt @@ -17,9 +17,6 @@ Restrictions/bugs: - SSI263 emulation is very basic: there is no attempt to emulate rate, inflection or filters. - During Mockingboard playback, Speaker emulation isn't precise. -Next release: -------------- -TBC 1.22.1 - 7 Mar 2013 -------------------- @@ -27,6 +24,9 @@ Changes: . Make 2x the default - But refuse double-sizing the window unless the screen is large enough. +Fixes: +. [Bug #018886] MMU no good when no cards in slot-4 & 5 + 1.22.0 - 1 Jan 2013 -------------------- diff --git a/AppleWin/source/Debugger/Debug.cpp b/AppleWin/source/Debugger/Debug.cpp index 95fc752a..1b5b28cb 100644 --- a/AppleWin/source/Debugger/Debug.cpp +++ b/AppleWin/source/Debugger/Debug.cpp @@ -1962,13 +1962,13 @@ Update_t CmdTraceFile (int nArgs) if (g_hTraceFile) { - sprintf( sText, "Trace started: %s", sFileName ); + sprintf( sText, "Trace started: %s", sFilePath ); g_bTraceHeader = true; } else { - sprintf( sText, "Trace ERROR: %s", sFileName ); + sprintf( sText, "Trace ERROR: %s", sFilePath ); } } diff --git a/AppleWin/source/Memory.cpp b/AppleWin/source/Memory.cpp index d4d1ecfb..1e346adc 100644 --- a/AppleWin/source/Memory.cpp +++ b/AppleWin/source/Memory.cpp @@ -583,15 +583,20 @@ BYTE __stdcall IORead_Cxxx(WORD programcounter, WORD address, BYTE write, BYTE v if (address >= APPLE_SLOT_BEGIN && address <= APPLE_SLOT_END) { // TODO:CHECK: NB. Currently Mockingboard/Phasor is never unplugged, just disabled. See MB_Read(). + // Fix for bug 18643 and bug 18886 const UINT uSlot = (address>>8)&0x7; - if (uSlot != 3 && !IsCardInSlot(uSlot)) + if ( (SW_SLOTCXROM) && // Peripheral (card) ROMs enabled in $C100..$C7FF + !(!SW_SLOTC3ROM && uSlot == 3) && // Internal C3 ROM disabled in $C300 when slot == 3 + !IsCardInSlot(uSlot) ) // Slot is empty + { return IO_Null(programcounter, address, write, value, nCyclesLeft); + } } if ((g_eExpansionRomType == eExpRomNull) && (address >= FIRMWARE_EXPANSION_BEGIN)) return IO_Null(programcounter, address, write, value, nCyclesLeft); - else - return mem[address]; + + return mem[address]; } BYTE __stdcall IOWrite_Cxxx(WORD programcounter, WORD address, BYTE write, BYTE value, ULONG nCyclesLeft) @@ -606,11 +611,15 @@ BYTE __stdcall IOWrite_Cxxx(WORD programcounter, WORD address, BYTE write, BYTE //=========================================================================== -static BYTE g_bmSlotInit = 0; +static struct SlotInfo +{ + bool bHasCard; + iofunction IOReadCx; + iofunction IOWriteCx; +} g_SlotInfo[NUM_SLOTS] = {0}; static void InitIoHandlers() { - g_bmSlotInit = 0; UINT i=0; for (; i<8; i++) // C00x..C07x @@ -641,14 +650,18 @@ static void InitIoHandlers() g_uPeripheralRomSlot = 0; for (i=0; i