mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-15 02:30:11 +00:00
Refactor: remove slot from InitializeIO() calls for card objects
This commit is contained in:
parent
ff7c9dc185
commit
67b3c28833
@ -74,7 +74,7 @@ Disk2InterfaceCard::Disk2InterfaceCard(UINT slot) :
|
||||
|
||||
// if created by user in Config->Disk, then MemInitializeIO() won't be called
|
||||
if (GetCxRomPeripheral())
|
||||
Initialize(GetCxRomPeripheral()); // During regular start-up, Initialize() will be called later by MemInitializeIO()
|
||||
InitializeIO(GetCxRomPeripheral()); // During regular start-up, Initialize() will be called later by MemInitializeIO()
|
||||
|
||||
// Debug:
|
||||
#if LOG_DISK_NIBBLES_USE_RUNTIME_VAR
|
||||
@ -1798,7 +1798,7 @@ void Disk2InterfaceCard::InitFirmware(LPBYTE pCxRomPeripheral)
|
||||
memcpy(pCxRomPeripheral + m_slot*APPLE_SLOT_SIZE, m_16SectorFirmware, DISK2_FW_SIZE);
|
||||
}
|
||||
|
||||
void Disk2InterfaceCard::Initialize(LPBYTE pCxRomPeripheral)
|
||||
void Disk2InterfaceCard::InitializeIO(LPBYTE pCxRomPeripheral)
|
||||
{
|
||||
bool res = GetFirmware(IDR_DISK2_13SECTOR_FW, m_13SectorFirmware);
|
||||
_ASSERT(res);
|
||||
|
@ -130,7 +130,7 @@ public:
|
||||
virtual void Init(void) {};
|
||||
virtual void Reset(const bool powerCycle);
|
||||
|
||||
void Initialize(LPBYTE pCxRomPeripheral);
|
||||
void InitializeIO(LPBYTE pCxRomPeripheral);
|
||||
void Destroy(void); // no, doesn't "destroy" the disk image. DiskIIManagerShutdown()
|
||||
|
||||
void Boot(void);
|
||||
|
@ -123,9 +123,9 @@ BYTE FourPlayCard::MyGetAsyncKeyState(int vKey)
|
||||
return GetAsyncKeyState(vKey) < 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
void FourPlayCard::InitializeIO(LPBYTE pCxRomPeripheral, UINT slot)
|
||||
void FourPlayCard::InitializeIO(LPBYTE pCxRomPeripheral)
|
||||
{
|
||||
RegisterIoHandler(slot, &FourPlayCard::IORead, IO_Null, IO_Null, IO_Null, this, NULL);
|
||||
RegisterIoHandler(m_slot, &FourPlayCard::IORead, IO_Null, IO_Null, IO_Null, this, NULL);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
virtual void Init(void) {};
|
||||
virtual void Reset(const bool powerCycle) {};
|
||||
|
||||
void InitializeIO(LPBYTE pCxRomPeripheral, UINT slot);
|
||||
void InitializeIO(LPBYTE pCxRomPeripheral);
|
||||
|
||||
static BYTE __stdcall IORead(WORD pc, WORD addr, BYTE bWrite, BYTE value, ULONG nExecutedCycles);
|
||||
|
||||
|
@ -130,7 +130,7 @@ HarddiskInterfaceCard::HarddiskInterfaceCard(UINT slot) :
|
||||
|
||||
// if created by user in Config->Disk, then MemInitializeIO() won't be called
|
||||
if (GetCxRomPeripheral())
|
||||
Initialize(GetCxRomPeripheral()); // During regular start-up, Initialize() will be called later by MemInitializeIO()
|
||||
InitializeIO(GetCxRomPeripheral()); // During regular start-up, Initialize() will be called later by MemInitializeIO()
|
||||
}
|
||||
|
||||
HarddiskInterfaceCard::~HarddiskInterfaceCard(void)
|
||||
@ -150,6 +150,21 @@ void HarddiskInterfaceCard::Reset(const bool powerCycle)
|
||||
|
||||
//===========================================================================
|
||||
|
||||
void HarddiskInterfaceCard::InitializeIO(const LPBYTE pCxRomPeripheral)
|
||||
{
|
||||
const DWORD HARDDISK_FW_SIZE = APPLE_SLOT_SIZE;
|
||||
|
||||
BYTE* pData = GetFrame().GetResource(IDR_HDDRVR_FW, "FIRMWARE", HARDDISK_FW_SIZE);
|
||||
if (pData == NULL)
|
||||
return;
|
||||
|
||||
memcpy(pCxRomPeripheral + m_slot * APPLE_SLOT_SIZE, pData, HARDDISK_FW_SIZE);
|
||||
|
||||
RegisterIoHandler(m_slot, IORead, IOWrite, NULL, NULL, this, NULL);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
void HarddiskInterfaceCard::CleanupDriveInternal(const int iDrive)
|
||||
{
|
||||
if (m_hardDiskDrive[iDrive].m_imagehandle)
|
||||
@ -281,21 +296,6 @@ void HarddiskInterfaceCard::GetFilenameAndPathForSaveState(std::string& filename
|
||||
|
||||
//===========================================================================
|
||||
|
||||
void HarddiskInterfaceCard::Initialize(const LPBYTE pCxRomPeripheral)
|
||||
{
|
||||
const DWORD HARDDISK_FW_SIZE = APPLE_SLOT_SIZE;
|
||||
|
||||
BYTE* pData = GetFrame().GetResource(IDR_HDDRVR_FW, "FIRMWARE", HARDDISK_FW_SIZE);
|
||||
if (pData == NULL)
|
||||
return;
|
||||
|
||||
memcpy(pCxRomPeripheral + m_slot * APPLE_SLOT_SIZE, pData, HARDDISK_FW_SIZE);
|
||||
|
||||
RegisterIoHandler(m_slot, IORead, IOWrite, NULL, NULL, this, NULL);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
void HarddiskInterfaceCard::Destroy(void)
|
||||
{
|
||||
m_saveDiskImage = false;
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
virtual void Init(void) {}
|
||||
virtual void Reset(const bool powerCycle);
|
||||
|
||||
void Initialize(const LPBYTE pCxRomPeripheral);
|
||||
void InitializeIO(const LPBYTE pCxRomPeripheral);
|
||||
void Destroy(void);
|
||||
const std::string& GetFullName(const int iDrive);
|
||||
const std::string& HarddiskGetFullPathName(const int iDrive);
|
||||
|
@ -1728,7 +1728,7 @@ void MemInitializeIO(void)
|
||||
PrintLoadRom(pCxRomPeripheral, SLOT1); // $C100 : Parallel printer f/w
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT2) == CT_SSC)
|
||||
dynamic_cast<CSuperSerialCard&>(GetCardMgr().GetRef(SLOT2)).CommInitialize(pCxRomPeripheral, SLOT2); // $C200 : SSC
|
||||
dynamic_cast<CSuperSerialCard&>(GetCardMgr().GetRef(SLOT2)).InitializeIO(pCxRomPeripheral); // $C200 : SSC
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT3) == CT_Uthernet)
|
||||
{
|
||||
@ -1738,18 +1738,18 @@ void MemInitializeIO(void)
|
||||
}
|
||||
else if (GetCardMgr().QuerySlot(SLOT3) == CT_FourPlay)
|
||||
{
|
||||
dynamic_cast<FourPlayCard&>(GetCardMgr().GetRef(SLOT3)).InitializeIO(pCxRomPeripheral, SLOT3);
|
||||
dynamic_cast<FourPlayCard&>(GetCardMgr().GetRef(SLOT3)).InitializeIO(pCxRomPeripheral);
|
||||
}
|
||||
else if (GetCardMgr().QuerySlot(SLOT3) == CT_SNESMAX)
|
||||
{
|
||||
dynamic_cast<SNESMAXCard&>(GetCardMgr().GetRef(SLOT3)).InitializeIO(pCxRomPeripheral, SLOT3);
|
||||
dynamic_cast<SNESMAXCard&>(GetCardMgr().GetRef(SLOT3)).InitializeIO(pCxRomPeripheral);
|
||||
}
|
||||
|
||||
// Apple//e: Auxiliary slot contains Extended 80 Column card or RamWorksIII card
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT4) == CT_MouseInterface)
|
||||
{
|
||||
dynamic_cast<CMouseInterface&>(GetCardMgr().GetRef(SLOT4)).Initialize(pCxRomPeripheral, SLOT4); // $C400 : Mouse f/w
|
||||
dynamic_cast<CMouseInterface&>(GetCardMgr().GetRef(SLOT4)).InitializeIO(pCxRomPeripheral); // $C400 : Mouse f/w
|
||||
}
|
||||
else if (GetCardMgr().QuerySlot(SLOT4) == CT_MockingboardC || GetCardMgr().QuerySlot(SLOT4) == CT_Phasor)
|
||||
{
|
||||
@ -1757,7 +1757,7 @@ void MemInitializeIO(void)
|
||||
}
|
||||
else if (GetCardMgr().QuerySlot(SLOT4) == CT_Z80)
|
||||
{
|
||||
ConfigureSoftcard(pCxRomPeripheral, SLOT4); // $C400 : Z80 card
|
||||
Z80_InitializeIO(pCxRomPeripheral, SLOT4); // $C400 : Z80 card
|
||||
}
|
||||
// else if (GetCardMgr().QuerySlot(SLOT4) == CT_GenericClock)
|
||||
// {
|
||||
@ -1765,39 +1765,39 @@ void MemInitializeIO(void)
|
||||
// }
|
||||
else if (GetCardMgr().QuerySlot(SLOT4) == CT_FourPlay)
|
||||
{
|
||||
dynamic_cast<FourPlayCard&>(GetCardMgr().GetRef(SLOT4)).InitializeIO(pCxRomPeripheral, SLOT4);
|
||||
dynamic_cast<FourPlayCard&>(GetCardMgr().GetRef(SLOT4)).InitializeIO(pCxRomPeripheral);
|
||||
}
|
||||
else if (GetCardMgr().QuerySlot(SLOT4) == CT_SNESMAX)
|
||||
{
|
||||
dynamic_cast<SNESMAXCard&>(GetCardMgr().GetRef(SLOT4)).InitializeIO(pCxRomPeripheral, SLOT4);
|
||||
dynamic_cast<SNESMAXCard&>(GetCardMgr().GetRef(SLOT4)).InitializeIO(pCxRomPeripheral);
|
||||
}
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT5) == CT_Z80)
|
||||
{
|
||||
ConfigureSoftcard(pCxRomPeripheral, SLOT5); // $C500 : Z80 card
|
||||
Z80_InitializeIO(pCxRomPeripheral, SLOT5); // $C500 : Z80 card
|
||||
}
|
||||
else if (GetCardMgr().QuerySlot(SLOT5) == CT_SAM)
|
||||
{
|
||||
dynamic_cast<SAMCard&>(GetCardMgr().GetRef(SLOT5)).InitializeIO(pCxRomPeripheral, SLOT5);
|
||||
dynamic_cast<SAMCard&>(GetCardMgr().GetRef(SLOT5)).InitializeIO(pCxRomPeripheral);
|
||||
}
|
||||
else if (GetCardMgr().QuerySlot(SLOT5) == CT_FourPlay)
|
||||
{
|
||||
dynamic_cast<FourPlayCard&>(GetCardMgr().GetRef(SLOT5)).InitializeIO(pCxRomPeripheral, SLOT5);
|
||||
dynamic_cast<FourPlayCard&>(GetCardMgr().GetRef(SLOT5)).InitializeIO(pCxRomPeripheral);
|
||||
}
|
||||
else if (GetCardMgr().QuerySlot(SLOT5) == CT_SNESMAX)
|
||||
{
|
||||
dynamic_cast<SNESMAXCard&>(GetCardMgr().GetRef(SLOT5)).InitializeIO(pCxRomPeripheral, SLOT5);
|
||||
dynamic_cast<SNESMAXCard&>(GetCardMgr().GetRef(SLOT5)).InitializeIO(pCxRomPeripheral);
|
||||
}
|
||||
else if (GetCardMgr().QuerySlot(SLOT5) == CT_Disk2)
|
||||
{
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT5)).Initialize(pCxRomPeripheral); // $C500 : Disk][ card
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT5)).InitializeIO(pCxRomPeripheral); // $C500 : Disk][ card
|
||||
}
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT6) == CT_Disk2)
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).Initialize(pCxRomPeripheral); // $C600 : Disk][ card
|
||||
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).InitializeIO(pCxRomPeripheral); // $C600 : Disk][ card
|
||||
|
||||
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
|
||||
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).Initialize(pCxRomPeripheral);
|
||||
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).InitializeIO(pCxRomPeripheral);
|
||||
}
|
||||
|
||||
// Called by:
|
||||
|
@ -172,13 +172,12 @@ void CMouseInterface::InitializeROM(void)
|
||||
memcpy(m_pSlotRom, pData, FW_SIZE);
|
||||
}
|
||||
|
||||
void CMouseInterface::Initialize(LPBYTE pCxRomPeripheral, UINT uSlot)
|
||||
void CMouseInterface::InitializeIO(LPBYTE pCxRomPeripheral)
|
||||
{
|
||||
// m_bActive = true;
|
||||
m_bEnabled = true;
|
||||
_ASSERT(m_uSlot == uSlot);
|
||||
SetSlotRom(); // Pre: m_bActive == true
|
||||
RegisterIoHandler(uSlot, &CMouseInterface::IORead, &CMouseInterface::IOWrite, NULL, NULL, this, NULL);
|
||||
RegisterIoHandler(m_uSlot, &CMouseInterface::IORead, &CMouseInterface::IOWrite, NULL, NULL, this, NULL);
|
||||
|
||||
if (m_syncEvent.m_active) g_SynchronousEventMgr.Remove(m_syncEvent.m_id);
|
||||
m_syncEvent.m_cyclesRemaining = NTSC_GetCyclesUntilVBlank(0);
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
virtual void Init(void) {};
|
||||
virtual void Reset(const bool powerCycle) {};
|
||||
|
||||
void Initialize(LPBYTE pCxRomPeripheral, UINT uSlot);
|
||||
void InitializeIO(LPBYTE pCxRomPeripheral);
|
||||
// void Uninitialize();
|
||||
void Reset();
|
||||
UINT GetSlot(void) { return m_uSlot; }
|
||||
|
@ -87,9 +87,9 @@ BYTE __stdcall SAMCard::IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG n
|
||||
return res;
|
||||
}
|
||||
|
||||
void SAMCard::InitializeIO(LPBYTE pCxRomPeripheral, UINT slot)
|
||||
void SAMCard::InitializeIO(LPBYTE pCxRomPeripheral)
|
||||
{
|
||||
RegisterIoHandler(slot, IO_Null, IOWrite, IO_Null, IO_Null, NULL, NULL);
|
||||
RegisterIoHandler(m_slot, IO_Null, IOWrite, IO_Null, IO_Null, NULL, NULL);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
virtual void Init(void) {};
|
||||
virtual void Reset(const bool powerCycle) {};
|
||||
|
||||
void InitializeIO(LPBYTE pCxRomPeripheral, UINT slot);
|
||||
void InitializeIO(LPBYTE pCxRomPeripheral);
|
||||
|
||||
static BYTE __stdcall IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE value, ULONG nExecutedCycles);
|
||||
|
||||
|
@ -202,9 +202,9 @@ BYTE __stdcall SNESMAXCard::IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE value,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SNESMAXCard::InitializeIO(LPBYTE pCxRomPeripheral, UINT slot)
|
||||
void SNESMAXCard::InitializeIO(LPBYTE pCxRomPeripheral)
|
||||
{
|
||||
RegisterIoHandler(slot, &SNESMAXCard::IORead, &SNESMAXCard::IOWrite, IO_Null, IO_Null, this, NULL);
|
||||
RegisterIoHandler(m_slot, &SNESMAXCard::IORead, &SNESMAXCard::IOWrite, IO_Null, IO_Null, this, NULL);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
virtual void Init(void) {};
|
||||
virtual void Reset(const bool powerCycle) {};
|
||||
|
||||
void InitializeIO(LPBYTE pCxRomPeripheral, UINT slot);
|
||||
void InitializeIO(LPBYTE pCxRomPeripheral);
|
||||
|
||||
static BYTE __stdcall IORead(WORD pc, WORD addr, BYTE bWrite, BYTE value, ULONG nExecutedCycles);
|
||||
static BYTE __stdcall IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE value, ULONG nExecutedCycles);
|
||||
|
@ -942,7 +942,7 @@ BYTE __stdcall CSuperSerialCard::CommDipSw(WORD, WORD addr, BYTE, BYTE, ULONG)
|
||||
|
||||
//===========================================================================
|
||||
|
||||
void CSuperSerialCard::CommInitialize(LPBYTE pCxRomPeripheral, UINT uSlot)
|
||||
void CSuperSerialCard::InitializeIO(LPBYTE pCxRomPeripheral)
|
||||
{
|
||||
const UINT SSC_FW_SIZE = 2*1024;
|
||||
const UINT SSC_SLOT_FW_SIZE = 256;
|
||||
@ -952,8 +952,7 @@ void CSuperSerialCard::CommInitialize(LPBYTE pCxRomPeripheral, UINT uSlot)
|
||||
if(pData == NULL)
|
||||
return;
|
||||
|
||||
_ASSERT(m_uSlot == uSlot);
|
||||
memcpy(pCxRomPeripheral + uSlot*256, pData+SSC_SLOT_FW_OFFSET, SSC_SLOT_FW_SIZE);
|
||||
memcpy(pCxRomPeripheral + m_uSlot*SSC_SLOT_FW_SIZE, pData+SSC_SLOT_FW_OFFSET, SSC_SLOT_FW_SIZE);
|
||||
|
||||
// Expansion ROM
|
||||
if (m_pExpansionRom == NULL)
|
||||
@ -966,7 +965,7 @@ void CSuperSerialCard::CommInitialize(LPBYTE pCxRomPeripheral, UINT uSlot)
|
||||
|
||||
//
|
||||
|
||||
RegisterIoHandler(uSlot, &CSuperSerialCard::SSC_IORead, &CSuperSerialCard::SSC_IOWrite, NULL, NULL, this, m_pExpansionRom);
|
||||
RegisterIoHandler(m_uSlot, &CSuperSerialCard::SSC_IORead, &CSuperSerialCard::SSC_IOWrite, NULL, NULL, this, m_pExpansionRom);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
virtual void Init(void) {};
|
||||
virtual void Reset(const bool powerCycle) {};
|
||||
|
||||
void CommInitialize(LPBYTE pCxRomPeripheral, UINT uSlot);
|
||||
void InitializeIO(LPBYTE pCxRomPeripheral);
|
||||
void CommReset();
|
||||
void CommDestroy();
|
||||
void CommSetSerialPort(DWORD dwNewSerialPortItem);
|
||||
|
@ -37,7 +37,7 @@ BYTE __stdcall CPMZ80_IOWrite(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULO
|
||||
|
||||
//===========================================================================
|
||||
|
||||
void ConfigureSoftcard(LPBYTE pCxRomPeripheral, UINT uSlot)
|
||||
void Z80_InitializeIO(LPBYTE pCxRomPeripheral, UINT uSlot)
|
||||
{
|
||||
memset(pCxRomPeripheral + (uSlot << 8), 0xFF, APPLE_SLOT_SIZE);
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
// Emula a CPU Z80
|
||||
|
||||
// Protótipos
|
||||
void ConfigureSoftcard(LPBYTE pCxRomPeripheral, UINT uSlot);
|
||||
void Z80_InitializeIO(LPBYTE pCxRomPeripheral, UINT uSlot);
|
||||
|
||||
// NB. These are in z80.cpp:
|
||||
std::string Z80_GetSnapshotCardName(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user