Fix: Floating bus not returned for empty slot $Cnxx addresses (Fix for A2VGA.DSK: Apple][VGA card detection).

This commit is contained in:
tomch 2012-01-21 14:36:35 +00:00
parent ec82e9f9e4
commit e614289098
3 changed files with 41 additions and 9 deletions

View file

@ -19,6 +19,12 @@ Restrictions/bugs:
- For an original Apple //e, 80-column (PR#3) and INVERSE, it still appears to be mousetext character, but it should be inverted upper-case from $40 to $5F.
1.xx.0 - ?? ??? 2012
--------------------
Fixes:
. Floating bus not returned for empty slot $Cnxx addresses (Fix for A2VGA.DSK: Apple][VGA card detection).
1.20.1 - 17 Jul 2011
--------------------
Fixes:

View file

@ -471,6 +471,8 @@ inline bool IsPotentialNoSlotClockAccess(const WORD address)
(!SW_SLOTCXROM && (AddrHi == 0xC8)) ); // Internal ROM at [$C100-CFFF] && AddrHi == $C8
}
static bool IsCardInSlot(const UINT uSlot);
// Enabling expansion ROM ($C800..$CFFF]:
// . Enable if: Enable1 && Enable2
// . Enable1 = I/O SELECT' (6502 accesses $Csxx)
@ -579,6 +581,14 @@ BYTE __stdcall IORead_Cxxx(WORD programcounter, WORD address, BYTE write, BYTE v
}
}
if (address >= APPLE_SLOT_BEGIN && address <= APPLE_SLOT_END)
{
// NB. Currently Mockingboard/Phasor is never unplugged, just disabled. See MB_Read().
const UINT uSlot = (address>>8)&0x7;
if (uSlot != 3 && !IsCardInSlot(uSlot))
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
@ -661,6 +671,17 @@ void RegisterIoHandler(UINT uSlot, iofunction IOReadC0, iofunction IOWriteC0, io
ExpansionRom[uSlot] = pExpansionRom;
}
static bool IsCardInSlot(const UINT uSlot)
{
if (IORead[uSlot+8] == IO_Null &&
IOWrite[uSlot+8] == IO_Null &&
IORead[uSlot*16] == IORead_Cxxx &&
IOWrite[uSlot*16] == IOWrite_Cxxx)
return false;
return true;
}
//===========================================================================
//// Only called by MemSetFastPaging()

View file

@ -1382,8 +1382,8 @@ static BYTE __stdcall MB_Read(WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, ULO
if(!IS_APPLE2 && !MemCheckSLOTCXROM())
return mem[nAddr];
if(g_SoundcardType == SC_NONE)
return 0;
if(g_SoundcardType == SC_NONE) // TODO: Should really unplug the card from the slot and let IORead_Cxxx() return the floating bus
return MemReadFloatingBus(nCyclesLeft);
BYTE nMB = (nAddr>>8)&0xf - SLOT4;
BYTE nOffset = nAddr&0xff;
@ -1391,26 +1391,31 @@ static BYTE __stdcall MB_Read(WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, ULO
if(g_bPhasorEnable)
{
if(nMB != 0) // Slot4 only
return 0;
return MemReadFloatingBus(nCyclesLeft);
BYTE nRes = 0;
int CS;
if(g_nPhasorMode & 1)
CS = ( ( nAddr & 0x80 ) >> 6 ) | ( ( nAddr & 0x10 ) >> 4 ); // 0, 1, 2 or 3
else // Mockingboard Mode
CS = ( ( nAddr & 0x80 ) >> 7 ) + 1; // 1 or 2
BYTE nRes = 0;
if(CS & 1)
nRes |= SY6522_Read(nMB*NUM_DEVS_PER_MB + SY6522_DEVICE_A, nAddr&0xf);
if(CS & 2)
nRes |= SY6522_Read(nMB*NUM_DEVS_PER_MB + SY6522_DEVICE_B, nAddr&0xf);
if((nOffset >= SSI263_Offset) && (nOffset <= (SSI263_Offset+0x05)))
nRes |= SSI263_Read(nMB, nAddr&0xf);
bool bAccessedDevice = (CS & 3) ? true : false;
return nRes;
if((nOffset >= SSI263_Offset) && (nOffset <= (SSI263_Offset+0x05)))
{
nRes |= SSI263_Read(nMB, nAddr&0xf);
bAccessedDevice = true;
}
return bAccessedDevice ? nRes : MemReadFloatingBus(nCyclesLeft);
}
if(nOffset <= (SY6522A_Offset+0x0F))
@ -1420,7 +1425,7 @@ static BYTE __stdcall MB_Read(WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, ULO
else if((nOffset >= SSI263_Offset) && (nOffset <= (SSI263_Offset+0x05)))
return SSI263_Read(nMB, nAddr&0xf);
else
return 0;
return MemReadFloatingBus(nCyclesLeft);
}
//-----------------------------------------------------------------------------