2019-12-19 19:42:30 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Card.h"
|
|
|
|
#include "Disk2CardManager.h"
|
2024-03-22 21:36:50 +00:00
|
|
|
#include "LanguageCard.h"
|
2023-01-28 18:15:28 +00:00
|
|
|
#include "MockingboardCardManager.h"
|
2020-11-11 21:15:27 +00:00
|
|
|
#include "Common.h"
|
2019-12-19 19:42:30 +00:00
|
|
|
|
|
|
|
class CardManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CardManager(void) :
|
|
|
|
m_pMouseCard(NULL),
|
2021-12-11 15:26:09 +00:00
|
|
|
m_pSSC(NULL),
|
2023-01-28 19:58:12 +00:00
|
|
|
m_pParallelPrinterCard(NULL),
|
|
|
|
m_pZ80Card(NULL)
|
2019-12-19 19:42:30 +00:00
|
|
|
{
|
2021-09-17 19:43:10 +00:00
|
|
|
InsertInternal(SLOT0, CT_Empty);
|
|
|
|
InsertInternal(SLOT1, CT_GenericPrinter);
|
|
|
|
InsertInternal(SLOT2, CT_SSC);
|
2022-03-13 17:19:15 +00:00
|
|
|
InsertInternal(SLOT3, CT_Empty);
|
2021-09-17 19:43:10 +00:00
|
|
|
InsertInternal(SLOT4, CT_Empty);
|
|
|
|
InsertInternal(SLOT5, CT_Empty);
|
|
|
|
InsertInternal(SLOT6, CT_Disk2);
|
|
|
|
InsertInternal(SLOT7, CT_Empty);
|
|
|
|
InsertAuxInternal(CT_Extended80Col); // For Apple //e and above
|
2019-12-19 19:42:30 +00:00
|
|
|
}
|
|
|
|
~CardManager(void)
|
|
|
|
{
|
|
|
|
for (UINT i=0; i<NUM_SLOTS; i++)
|
2020-12-06 18:43:18 +00:00
|
|
|
RemoveInternal(i);
|
|
|
|
RemoveAuxInternal();
|
2019-12-19 19:42:30 +00:00
|
|
|
}
|
|
|
|
|
2021-09-17 19:43:10 +00:00
|
|
|
void Insert(UINT slot, SS_CARDTYPE type, bool updateRegistry = true);
|
2021-10-19 20:56:19 +00:00
|
|
|
void Remove(UINT slot, bool updateRegistry = true);
|
2020-10-25 17:14:23 +00:00
|
|
|
SS_CARDTYPE QuerySlot(UINT slot) { _ASSERT(slot<NUM_SLOTS); return m_slot[slot]->QueryType(); }
|
2020-01-04 12:27:25 +00:00
|
|
|
Card& GetRef(UINT slot)
|
|
|
|
{
|
2021-11-25 20:23:21 +00:00
|
|
|
_ASSERT(m_slot[slot]);
|
2020-01-04 12:27:25 +00:00
|
|
|
return *m_slot[slot];
|
|
|
|
}
|
2021-09-18 10:55:29 +00:00
|
|
|
Card* GetObj(UINT slot)
|
|
|
|
{
|
|
|
|
return m_slot[slot];
|
|
|
|
}
|
2019-12-19 19:42:30 +00:00
|
|
|
|
|
|
|
void InsertAux(SS_CARDTYPE type);
|
|
|
|
void RemoveAux(void);
|
|
|
|
SS_CARDTYPE QueryAux(void) { return m_aux->QueryType(); }
|
|
|
|
Card* GetObjAux(void) { _ASSERT(0); return m_aux; } // ASSERT because this is a DummyCard
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
Disk2CardManager& GetDisk2CardMgr(void) { return m_disk2CardMgr; }
|
2024-03-22 21:36:50 +00:00
|
|
|
LanguageCardManager& GetLanguageCardMgr(void) { return m_languageCardMgr; }
|
2023-01-28 18:15:28 +00:00
|
|
|
MockingboardCardManager& GetMockingboardCardMgr(void) { return m_mockingboardCardMgr; }
|
2019-12-19 19:42:30 +00:00
|
|
|
class CMouseInterface* GetMouseCard(void) { return m_pMouseCard; }
|
|
|
|
bool IsMouseCardInstalled(void) { return m_pMouseCard != NULL; }
|
|
|
|
class CSuperSerialCard* GetSSC(void) { return m_pSSC; }
|
|
|
|
bool IsSSCInstalled(void) { return m_pSSC != NULL; }
|
2022-03-18 22:04:34 +00:00
|
|
|
class ParallelPrinterCard* GetParallelPrinterCard(void) { return m_pParallelPrinterCard; }
|
|
|
|
bool IsParallelPrinterCardInstalled(void) { return m_pParallelPrinterCard != NULL; }
|
2019-12-19 19:42:30 +00:00
|
|
|
|
2021-11-11 21:45:55 +00:00
|
|
|
void InitializeIO(LPBYTE pCxRomPeripheral);
|
2023-01-28 18:15:28 +00:00
|
|
|
void Destroy(void);
|
2022-03-11 22:17:03 +00:00
|
|
|
void Reset(const bool powerCycle);
|
2021-11-13 18:13:01 +00:00
|
|
|
void Update(const ULONG nExecutedCycles);
|
2021-12-11 15:26:09 +00:00
|
|
|
void SaveSnapshot(YamlSaveHelper& yamlSaveHelper);
|
2021-11-11 21:45:55 +00:00
|
|
|
|
2019-12-19 19:42:30 +00:00
|
|
|
private:
|
2021-09-17 19:43:10 +00:00
|
|
|
void InsertInternal(UINT slot, SS_CARDTYPE type);
|
|
|
|
void InsertAuxInternal(SS_CARDTYPE type);
|
2019-12-19 19:42:30 +00:00
|
|
|
void RemoveInternal(UINT slot);
|
2020-12-09 20:19:49 +00:00
|
|
|
void RemoveAuxInternal(void);
|
2019-12-19 19:42:30 +00:00
|
|
|
|
|
|
|
Card* m_slot[NUM_SLOTS];
|
|
|
|
Card* m_aux;
|
|
|
|
Disk2CardManager m_disk2CardMgr;
|
2024-03-22 21:36:50 +00:00
|
|
|
LanguageCardManager m_languageCardMgr;
|
2023-01-28 18:15:28 +00:00
|
|
|
MockingboardCardManager m_mockingboardCardMgr;
|
2019-12-19 19:42:30 +00:00
|
|
|
class CMouseInterface* m_pMouseCard;
|
|
|
|
class CSuperSerialCard* m_pSSC;
|
2022-03-18 22:04:34 +00:00
|
|
|
class ParallelPrinterCard* m_pParallelPrinterCard;
|
2023-02-20 19:57:25 +00:00
|
|
|
class Z80Card* m_pZ80Card;
|
2019-12-19 19:42:30 +00:00
|
|
|
};
|