Refactor slots & allow empty slots for s1(printer), s6(disk2)

. NB. can't empty s3(uthernet) yet
This commit is contained in:
tomcw
2019-09-15 20:37:20 +01:00
parent 94556b5eaf
commit 506a52f359
10 changed files with 97 additions and 78 deletions
+27 -20
View File
@@ -291,7 +291,7 @@ void SetExpansionMemType(const SS_CARDTYPE type)
newSlotAuxCard = type;
}
g_Slot0 = newSlot0Card;
g_Slot[0] = newSlot0Card;
g_SlotAux = newSlotAuxCard;
}
@@ -302,9 +302,9 @@ void CreateLanguageCard(void)
if (IsApple2PlusOrClone(GetApple2Type()))
{
if (g_Slot0 == CT_Saturn128K)
if (g_Slot[0] == CT_Saturn128K)
g_pLanguageCard = new Saturn128K(g_uSaturnBanksFromCmdLine);
else if (g_Slot0 == CT_LanguageCard)
else if (g_Slot[0] == CT_LanguageCard)
g_pLanguageCard = new LanguageCardSlot0;
else
g_pLanguageCard = NULL;
@@ -318,7 +318,7 @@ void CreateLanguageCard(void)
SS_CARDTYPE GetCurrentExpansionMemType(void)
{
if (IsApple2PlusOrClone(GetApple2Type()))
return g_Slot0;
return g_Slot[0];
else
return g_SlotAux;
}
@@ -1048,7 +1048,7 @@ static void ResetPaging(BOOL initialize)
{
SetLastRamWrite(0);
if (IsApple2PlusOrClone(GetApple2Type()) && g_Slot0 == CT_Empty)
if (IsApple2PlusOrClone(GetApple2Type()) && g_Slot[0] == CT_Empty)
SetMemMode(0);
else
SetMemMode(LanguageCardUnit::kMemModeInitialState);
@@ -1572,7 +1572,7 @@ void MemInitializeCustomF8ROM(void)
const UINT F8RomSize = 0x800;
const UINT F8RomOffset = Apple2RomSize-F8RomSize;
if (IsApple2Original(GetApple2Type()) && g_Slot0 == CT_LanguageCard)
if (IsApple2Original(GetApple2Type()) && g_Slot[0] == CT_LanguageCard)
{
try
{
@@ -1654,47 +1654,54 @@ void MemInitializeIO(void)
else
RegisterIoHandler(LanguageCardUnit::kSlot0, IO_Null, IO_Null, NULL, NULL, NULL, NULL);
// TODO: Cleanup peripheral setup!!!
PrintLoadRom(pCxRomPeripheral, 1); // $C100 : Parallel printer f/w
if (g_Slot[1] == CT_GenericPrinter)
PrintLoadRom(pCxRomPeripheral, 1); // $C100 : Parallel printer f/w
if (g_Slot2 == CT_SSC)
if (g_Slot[2] == CT_SSC)
sg_SSC.CommInitialize(pCxRomPeripheral, 2); // $C200 : SSC
// Slot 3 contains the Uthernet card (which can coexist with an 80-col+Ram card in AUX slot)
// . Uthernet card has no ROM and only IO mapped at $C0Bx
if (g_Slot[3] == CT_Uthernet)
{
// Slot 3 contains the Uthernet card (which can coexist with an 80-col+Ram card in AUX slot)
// . Uthernet card has no ROM and only IO mapped at $C0Bx
// NB. I/O handlers setup via tfe_init() & update_tfe_interface()
}
// Apple//e: Auxilary slot contains Extended 80 Column card or RamWorksIII card
if (g_Slot4 == CT_MouseInterface)
if (g_Slot[4] == CT_MouseInterface)
{
sg_Mouse.Initialize(pCxRomPeripheral, 4); // $C400 : Mouse f/w
}
else if (g_Slot4 == CT_MockingboardC || g_Slot4 == CT_Phasor)
else if (g_Slot[4] == CT_MockingboardC || g_Slot[4] == CT_Phasor)
{
const UINT uSlot4 = 4;
const UINT uSlot5 = 5;
MB_InitializeIO(pCxRomPeripheral, uSlot4, uSlot5);
}
else if (g_Slot4 == CT_Z80)
else if (g_Slot[4] == CT_Z80)
{
ConfigureSoftcard(pCxRomPeripheral, 4); // $C400 : Z80 card
}
// else if (g_Slot4 == CT_GenericClock)
// else if (g_Slot[4] == CT_GenericClock)
// {
// LoadRom_Clock_Generic(pCxRomPeripheral, 4);
// }
if (g_Slot5 == CT_Z80)
if (g_Slot[5] == CT_Z80)
{
ConfigureSoftcard(pCxRomPeripheral, 5); // $C500 : Z80 card
}
else if (g_Slot5 == CT_SAM)
else if (g_Slot[5] == CT_SAM)
{
ConfigureSAM(pCxRomPeripheral, 5); // $C500 : Z80 card
}
sg_Disk2Card.Initialize(pCxRomPeripheral, 6); // $C600 : Disk][ card
HD_Load_Rom(pCxRomPeripheral, 7); // $C700 : HDD f/w
if (g_Slot[6] == CT_Disk2)
sg_Disk2Card.Initialize(pCxRomPeripheral, 6); // $C600 : Disk][ card
if (g_Slot[7] == CT_GenericHDD)
HD_Load_Rom(pCxRomPeripheral, 7); // $C700 : HDD f/w
//
@@ -2346,7 +2353,7 @@ static void MemLoadSnapshotAuxCommon(YamlLoadHelper& yamlLoadHelper, const std::
yamlLoadHelper.PopMap();
}
g_Slot0 = CT_Empty;
g_Slot[0] = CT_Empty;
g_SlotAux = type;
memaux = RWpages[g_uActiveBank];