Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Andrea Odetti 2021-11-02 12:07:38 +00:00
commit 94de9e9e00
29 changed files with 591 additions and 608 deletions

View file

@ -31,14 +31,17 @@ enum SLOTS { SLOT0=0, SLOT1, SLOT2, SLOT3, SLOT4, SLOT5, SLOT6, SLOT7, NUM_SLOTS
class Card
{
public:
Card(void) : m_type(CT_Empty) {}
Card(SS_CARDTYPE type) : m_type(type) {}
Card(void) : m_type(CT_Empty), m_slot(SLOT0) {}
Card(SS_CARDTYPE type, UINT slot) : m_type(type), m_slot(slot) {}
virtual ~Card(void) {}
virtual void Init(void) = 0;
virtual void Reset(const bool powerCycle) = 0;
SS_CARDTYPE QueryType(void) { return m_type; }
protected:
UINT m_slot;
private:
SS_CARDTYPE m_type;
};
@ -60,7 +63,7 @@ public:
class DummyCard : public Card // For cards that currently can't be instantiated (ie. don't exist as a class)
{
public:
DummyCard(SS_CARDTYPE type) : Card(type) {}
DummyCard(SS_CARDTYPE type, UINT slot) : Card(type, slot) {}
virtual ~DummyCard(void) {}
virtual void Init(void) {};

View file

@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Disk.h"
#include "FourPlay.h"
#include "Harddisk.h"
#include "MouseInterface.h"
#include "SAM.h"
#include "SerialComms.h"
@ -58,16 +59,16 @@ void CardManager::InsertInternal(UINT slot, SS_CARDTYPE type)
m_slot[slot] = m_pSSC = new CSuperSerialCard(slot);
break;
case CT_MockingboardC:
m_slot[slot] = new DummyCard(type);
m_slot[slot] = new DummyCard(type, slot);
break;
case CT_GenericPrinter:
m_slot[slot] = new DummyCard(type);
m_slot[slot] = new DummyCard(type, slot);
break;
case CT_GenericHDD:
m_slot[slot] = new DummyCard(type);
m_slot[slot] = new HarddiskInterfaceCard(slot);
break;
case CT_GenericClock:
m_slot[slot] = new DummyCard(type);
m_slot[slot] = new DummyCard(type, slot);
break;
case CT_MouseInterface:
_ASSERT(m_pMouseCard == NULL);
@ -75,19 +76,19 @@ void CardManager::InsertInternal(UINT slot, SS_CARDTYPE type)
m_slot[slot] = m_pMouseCard = new CMouseInterface(slot);
break;
case CT_Z80:
m_slot[slot] = new DummyCard(type);
m_slot[slot] = new DummyCard(type, slot);
break;
case CT_Phasor:
m_slot[slot] = new DummyCard(type);
m_slot[slot] = new DummyCard(type, slot);
break;
case CT_Echo:
m_slot[slot] = new DummyCard(type);
m_slot[slot] = new DummyCard(type, slot);
break;
case CT_SAM:
m_slot[slot] = new SAMCard(slot);
break;
case CT_Uthernet:
m_slot[slot] = new DummyCard(type);
m_slot[slot] = new DummyCard(type, slot);
break;
case CT_Uthernet2:
m_slot[slot] = new DummyCard(type);
@ -108,7 +109,7 @@ void CardManager::InsertInternal(UINT slot, SS_CARDTYPE type)
break;
}
}
m_slot[slot] = new DummyCard(type);
m_slot[slot] = new DummyCard(type, slot);
break;
case CT_LanguageCardIIe: // not a card
@ -155,13 +156,13 @@ void CardManager::InsertAuxInternal(SS_CARDTYPE type)
m_aux = new EmptyCard;
break;
case CT_80Col:
m_aux = new DummyCard(type);
m_aux = new DummyCard(type, SLOT_AUX);
break;
case CT_Extended80Col:
m_aux = new DummyCard(type);
m_aux = new DummyCard(type, SLOT_AUX);
break;
case CT_RamWorksIII:
m_aux = new DummyCard(type);
m_aux = new DummyCard(type, SLOT_AUX);
break;
default:
_ASSERT(0);

View file

@ -34,13 +34,13 @@ public:
Card& GetRef(UINT slot)
{
SS_CARDTYPE t=QuerySlot(slot);
_ASSERT((t==CT_SSC || t==CT_MouseInterface || t==CT_Disk2 || t == CT_FourPlay || t == CT_SNESMAX || t == CT_SAM) && m_slot[slot]);
_ASSERT((t==CT_GenericHDD || t==CT_SSC || t==CT_MouseInterface || t==CT_Disk2 || t == CT_FourPlay || t == CT_SNESMAX || t == CT_SAM) && m_slot[slot]);
return *m_slot[slot];
}
Card* GetObj(UINT slot)
{
SS_CARDTYPE t=QuerySlot(slot);
_ASSERT(t==CT_SSC || t==CT_MouseInterface || t==CT_Disk2 || t == CT_FourPlay || t == CT_SNESMAX || t == CT_SAM);
_ASSERT(t == CT_GenericHDD || t==CT_SSC || t==CT_MouseInterface || t==CT_Disk2 || t == CT_FourPlay || t == CT_SNESMAX || t == CT_SAM);
return m_slot[slot];
}

View file

@ -84,7 +84,7 @@ INT_PTR CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARA
if (m_PropertySheetHelper.GetConfigOld().m_Slot[SLOT7] != m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT7])
{
if (m_PropertySheetHelper.GetConfigOld().m_Slot[SLOT7] == CT_GenericHDD || m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT7] == CT_GenericHDD)
HD_SetEnabled(m_PropertySheetHelper.GetConfigOld().m_Slot[SLOT7] == CT_GenericHDD);
m_PropertySheetHelper.SetSlot(SLOT7, m_PropertySheetHelper.GetConfigOld().m_Slot[SLOT7]);
}
DlgCANCEL(hWnd);
break;
@ -149,11 +149,20 @@ INT_PTR CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARA
case IDC_HDD_ENABLE:
{
const BOOL checked = IsDlgButtonChecked(hWnd, IDC_HDD_ENABLE) ? TRUE : FALSE;
m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT7] = checked ? CT_GenericHDD : CT_Empty;
// NB. Unusual as it creates slot object when checkbox is toggled (instead of after OK)
// Needed as we need a HarddiskInterfaceCard object so that images can be inserted/ejected [*2]
HD_SetEnabled(m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT7] == CT_GenericHDD);
EnableHDD(hWnd, checked);
// Add some user-protection, as (currently) removing the HDD images can't be undone!
if (checked || !checked && GetFrame().FrameMessageBox("This will unplug the HDD image(s)! Proceed?", "Eject/Unplug Warning", MB_ICONWARNING | MB_YESNO | MB_SETFOREGROUND) != IDNO)
{
m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT7] = checked ? CT_GenericHDD : CT_Empty;
// NB. Unusual as it creates slot object when checkbox is toggled (instead of after OK)
// Needed as we need a HarddiskInterfaceCard object so that images can be inserted/ejected [*2]
m_PropertySheetHelper.SetSlot(SLOT7, m_PropertySheetHelper.GetConfigNew().m_Slot[SLOT7]);
InitComboHDD(hWnd, SLOT7); // disabling will remove the HDD images - so update drop-down to reflect this
EnableHDD(hWnd, checked);
}
else
{
CheckDlgButton(hWnd, IDC_HDD_ENABLE, BST_CHECKED);
}
}
break;
case IDC_HDD_SWAP:
@ -184,7 +193,7 @@ INT_PTR CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARA
RegLoadString(TEXT(REG_CONFIG), REGVALUE_CIDERPRESSLOC, 1, PathToCiderPress, MAX_PATH, TEXT(""));
SendDlgItemMessage(hWnd, IDC_CIDERPRESS_FILENAME ,WM_SETTEXT, 0, (LPARAM)PathToCiderPress);
CheckDlgButton(hWnd, IDC_HDD_ENABLE, HD_CardIsEnabled() ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWnd, IDC_HDD_ENABLE, (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD) ? BST_CHECKED : BST_UNCHECKED);
EnableHDD(hWnd, IsDlgButtonChecked(hWnd, IDC_HDD_ENABLE));
@ -226,15 +235,19 @@ void CPageDisk::InitComboHDD(HWND hWnd, UINT /*slot*/)
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_HDD1, m_defaultHDDOptions, -1);
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_HDD2, m_defaultHDDOptions, -1);
if (!HD_GetFullName(HARDDISK_1).empty())
if (GetCardMgr().QuerySlot(SLOT7) != CT_GenericHDD)
return;
HarddiskInterfaceCard& card = dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7));
if (!card.GetFullName(HARDDISK_1).empty())
{
SendDlgItemMessage(hWnd, IDC_COMBO_HDD1, CB_INSERTSTRING, 0, (LPARAM)HD_GetFullName(HARDDISK_1).c_str());
SendDlgItemMessage(hWnd, IDC_COMBO_HDD1, CB_INSERTSTRING, 0, (LPARAM)card.GetFullName(HARDDISK_1).c_str());
SendDlgItemMessage(hWnd, IDC_COMBO_HDD1, CB_SETCURSEL, 0, 0);
}
if (!HD_GetFullName(HARDDISK_2).empty())
if (!card.GetFullName(HARDDISK_2).empty())
{
SendDlgItemMessage(hWnd, IDC_COMBO_HDD2, CB_INSERTSTRING, 0, (LPARAM)HD_GetFullName(HARDDISK_2).c_str());
SendDlgItemMessage(hWnd, IDC_COMBO_HDD2, CB_INSERTSTRING, 0, (LPARAM)card.GetFullName(HARDDISK_2).c_str());
SendDlgItemMessage(hWnd, IDC_COMBO_HDD2, CB_SETCURSEL, 0, 0);
}
}
@ -315,6 +328,11 @@ void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected
if (!IsDlgButtonChecked(hWnd, IDC_HDD_ENABLE))
return;
_ASSERT(GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD);
if (GetCardMgr().QuerySlot(SLOT7) != CT_GenericHDD)
return;
HarddiskInterfaceCard& card = dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7));
// Search from "select hard drive"
DWORD dwOpenDialogIndex = (DWORD)SendDlgItemMessage(hWnd, comboSelected, CB_FINDSTRINGEXACT, -1, (LPARAM)&m_defaultHDDOptions[0]);
DWORD dwComboSelection = (DWORD)SendDlgItemMessage(hWnd, comboSelected, CB_GETCURSEL, 0, 0);
@ -324,7 +342,7 @@ void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected
if (dwComboSelection == dwOpenDialogIndex)
{
EnableHDD(hWnd, FALSE); // Prevent multiple Selection dialogs to be triggered
bool bRes = HD_Select(driveSelected);
bool bRes = card.Select(driveSelected);
EnableHDD(hWnd, TRUE);
if (!bRes)
@ -341,13 +359,13 @@ void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected
SendDlgItemMessage(hWnd, comboSelected, CB_DELETESTRING, 0, 0);
}
SendDlgItemMessage(hWnd, comboSelected, CB_INSERTSTRING, 0, (LPARAM)HD_GetFullName(driveSelected).c_str());
SendDlgItemMessage(hWnd, comboSelected, CB_INSERTSTRING, 0, (LPARAM)card.GetFullName(driveSelected).c_str());
SendDlgItemMessage(hWnd, comboSelected, CB_SETCURSEL, 0, 0);
// If the HD was in the other combo, remove now
DWORD comboOther = (comboSelected == IDC_COMBO_HDD1) ? IDC_COMBO_HDD2 : IDC_COMBO_HDD1;
DWORD duplicated = (DWORD)SendDlgItemMessage(hWnd, comboOther, CB_FINDSTRINGEXACT, -1, (LPARAM)HD_GetFullName(driveSelected).c_str());
DWORD duplicated = (DWORD)SendDlgItemMessage(hWnd, comboOther, CB_FINDSTRINGEXACT, -1, (LPARAM)card.GetFullName(driveSelected).c_str());
if (duplicated != CB_ERR)
{
SendDlgItemMessage(hWnd, comboOther, CB_DELETESTRING, duplicated, 0);
@ -361,7 +379,7 @@ void CPageDisk::HandleHDDCombo(HWND hWnd, UINT driveSelected, UINT comboSelected
if (RemovalConfirmation(comboSelected))
{
// Unplug selected disk
HD_Unplug(driveSelected);
card.Unplug(driveSelected);
// Remove drive from list
SendDlgItemMessage(hWnd, comboSelected, CB_DELETESTRING, 0, 0);
}
@ -447,7 +465,10 @@ void CPageDisk::HandleHDDSwap(HWND hWnd)
if (!RemovalConfirmation(IDC_HDD_SWAP))
return;
if (!HD_ImageSwap())
if (GetCardMgr().QuerySlot(SLOT7) != CT_GenericHDD)
return;
if (!dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).ImageSwap())
return;
InitComboHDD(hWnd, SLOT7);
@ -482,7 +503,7 @@ UINT CPageDisk::RemovalConfirmation(UINT uCommand)
if (bMsgBox)
{
int nRes = GetFrame().FrameMessageBox(szText, TEXT("Eject/Unplug Warning"), MB_ICONWARNING | MB_YESNO | MB_SETFOREGROUND);
int nRes = GetFrame().FrameMessageBox(szText, "Eject/Unplug Warning", MB_ICONWARNING | MB_YESNO | MB_SETFOREGROUND);
if (nRes == IDNO)
uCommand = 0;
}

View file

@ -393,7 +393,7 @@ void CPropertySheetHelper::RestoreCurrentConfig(void)
SetSlot(SLOT3, m_ConfigOld.m_Slot[SLOT3]);
SetSlot(SLOT4, m_ConfigOld.m_Slot[SLOT4]);
SetSlot(SLOT5, m_ConfigOld.m_Slot[SLOT5]);
HD_SetEnabled(m_ConfigOld.m_Slot[SLOT7] == CT_GenericHDD);
SetSlot(SLOT7, m_ConfigOld.m_Slot[SLOT7]);
GetPropertySheet().SetTheFreezesF8Rom(m_ConfigOld.m_bEnableTheFreezesF8Rom);
}

View file

@ -58,8 +58,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
const BYTE Disk2InterfaceCard::m_T00S00Pattern[] = {0xD5,0xAA,0x96,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xDE};
Disk2InterfaceCard::Disk2InterfaceCard(UINT slot) :
Card(CT_Disk2),
m_slot(slot)
Card(CT_Disk2, slot)
{
ResetSwitches();
@ -72,6 +71,10 @@ Disk2InterfaceCard::Disk2InterfaceCard(UINT slot) :
ResetLogicStateSequencer();
// if created by user in Config->Disk, then MemInitializeIO() won't be called
if (GetCxRomPeripheral())
InitializeIO(GetCxRomPeripheral()); // During regular start-up, Initialize() will be called later by MemInitializeIO()
// Debug:
#if LOG_DISK_NIBBLES_USE_RUNTIME_VAR
m_bLogDisk_NibblesRW = false;
@ -86,6 +89,9 @@ Disk2InterfaceCard::~Disk2InterfaceCard(void)
{
EjectDiskInternal(DRIVE_1);
EjectDiskInternal(DRIVE_2);
// if destroyed by user in Config->Disk, then ensure that old object's reference is removed
UnregisterIoHandler(m_slot);
}
bool Disk2InterfaceCard::GetEnhanceDisk(void) { return m_enhanceDisk; }
@ -1791,8 +1797,7 @@ void Disk2InterfaceCard::InitFirmware(LPBYTE pCxRomPeripheral)
memcpy(pCxRomPeripheral + m_slot*APPLE_SLOT_SIZE, m_16SectorFirmware, DISK2_FW_SIZE);
}
// TODO: LoadRom_Disk_Floppy()
void Disk2InterfaceCard::Initialize(LPBYTE pCxRomPeripheral, UINT uSlot)
void Disk2InterfaceCard::InitializeIO(LPBYTE pCxRomPeripheral)
{
bool res = GetFirmware(IDR_DISK2_13SECTOR_FW, m_13SectorFirmware);
_ASSERT(res);
@ -1807,10 +1812,7 @@ void Disk2InterfaceCard::Initialize(LPBYTE pCxRomPeripheral, UINT uSlot)
// . Patching the firmware breaks the ADC checksum used by "The CIA Files" (Tricky Dick)
// . In this case we can patch to compensate for an ADC or EOR checksum but not both (nickw)
_ASSERT(m_slot == uSlot);
RegisterIoHandler(uSlot, &Disk2InterfaceCard::IORead, &Disk2InterfaceCard::IOWrite, NULL, NULL, this, NULL);
m_slot = uSlot;
RegisterIoHandler(m_slot, &Disk2InterfaceCard::IORead, &Disk2InterfaceCard::IOWrite, NULL, NULL, this, NULL);
InitFirmware(pCxRomPeripheral);
}

View file

@ -130,7 +130,7 @@ public:
virtual void Init(void) {};
virtual void Reset(const bool powerCycle);
void Initialize(LPBYTE pCxRomPeripheral, UINT uSlot);
void InitializeIO(LPBYTE pCxRomPeripheral);
void Destroy(void); // no, doesn't "destroy" the disk image. DiskIIManagerShutdown()
void Boot(void);
@ -246,7 +246,6 @@ private:
WORD m_magnetStates; // state bits for stepper motor magnet states (phases 0 - 3)
bool m_saveDiskImage;
UINT m_slot;
unsigned __int64 m_diskLastCycle;
unsigned __int64 m_diskLastReadLatchCycle;
FormatTrack m_formatTrack;

View file

@ -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);
}
//===========================================================================

View file

@ -6,8 +6,7 @@ class FourPlayCard : public Card
{
public:
FourPlayCard(UINT slot) :
Card(CT_FourPlay),
m_slot(slot)
Card(CT_FourPlay, slot)
{
}
virtual ~FourPlayCard(void) {}
@ -15,7 +14,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);
@ -27,6 +26,4 @@ public:
private:
static BYTE MyGetAsyncKeyState(int vKey);
UINT m_slot;
};

File diff suppressed because it is too large Load diff

View file

@ -23,36 +23,110 @@ along with AppleWin; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Card.h"
#include "DiskImage.h"
#include "DiskImageHelper.h"
// 1.19.0.0 Hard Disk Status/Indicator Light
#define HD_LED 1
enum HardDrive_e
{
HARDDISK_1 = 0,
HARDDISK_2,
NUM_HARDDISKS
};
enum HardDrive_e
class HardDiskDrive
{
public:
HardDiskDrive(void)
{
HARDDISK_1 = 0,
HARDDISK_2,
NUM_HARDDISKS
};
clear();
}
~HardDiskDrive(void) {}
void HD_Destroy(void);
bool HD_CardIsEnabled(void);
void HD_SetEnabled(const bool bEnabled, bool updateRegistry = true);
const std::string & HD_GetFullName(const int iDrive);
const std::string & HD_GetFullPathName(const int iDrive);
void HD_GetFilenameAndPathForSaveState(std::string& filename, std::string& path);
void HD_Reset(void);
void HD_Load_Rom(const LPBYTE pCxRomPeripheral, const UINT uSlot);
bool HD_Select(const int iDrive);
BOOL HD_Insert(const int iDrive, const std::string& pathname);
void HD_Unplug(const int iDrive);
bool HD_IsDriveUnplugged(const int iDrive);
void HD_LoadLastDiskImage(const int iDrive);
void clear()
{
m_imagename.clear();
m_fullname.clear();
m_strFilenameInZip.clear();
m_imagehandle = NULL;
m_bWriteProtected = false;
//
m_error = 0;
m_memblock = 0;
m_diskblock = 0;
m_buf_ptr = 0;
m_imageloaded = false;
memset(m_buf, 0, sizeof(m_buf));
m_status_next = DISK_STATUS_OFF;
m_status_prev = DISK_STATUS_OFF;
}
// 1.19.0.0 Hard Disk Status/Indicator Light
void HD_GetLightStatus (Disk_Status_e *pDisk1Status_);
bool HD_ImageSwap(void);
// From FloppyDisk
std::string m_imagename; // <FILENAME> (ie. no extension)
std::string m_fullname; // <FILENAME.EXT> or <FILENAME.zip>
std::string m_strFilenameInZip; // "" or <FILENAME.EXT> [not used]
ImageInfo* m_imagehandle; // Init'd by HD_Insert() -> ImageOpen()
bool m_bWriteProtected; // Needed for ImageOpen() [otherwise not used]
//
BYTE m_error; // NB. Firmware requires that b0=0 (OK) or b0=1 (Error)
WORD m_memblock;
UINT m_diskblock;
WORD m_buf_ptr;
bool m_imageloaded;
BYTE m_buf[HD_BLOCK_SIZE];
std::string HD_GetSnapshotCardName(void);
void HD_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
bool HD_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version, const std::string & strSaveStatePath);
Disk_Status_e m_status_next;
Disk_Status_e m_status_prev;
};
class HarddiskInterfaceCard : public Card
{
public:
HarddiskInterfaceCard(UINT slot);
virtual ~HarddiskInterfaceCard(void);
virtual void Init(void) {}
virtual void Reset(const bool powerCycle);
void InitializeIO(const LPBYTE pCxRomPeripheral);
void Destroy(void);
const std::string& GetFullName(const int iDrive);
const std::string& HarddiskGetFullPathName(const int iDrive);
void GetFilenameAndPathForSaveState(std::string& filename, std::string& path);
bool Select(const int iDrive);
BOOL Insert(const int iDrive, const std::string& pathname);
void Unplug(const int iDrive);
bool IsDriveUnplugged(const int iDrive);
void LoadLastDiskImage(const int iDrive);
void GetLightStatus(Disk_Status_e* pDisk1Status);
bool ImageSwap(void);
static std::string GetSnapshotCardName(void);
void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version, const std::string& strSaveStatePath);
static BYTE __stdcall IORead(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
static BYTE __stdcall IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
private:
void CleanupDriveInternal(const int iDrive);
void CleanupDrive(const int iDrive);
void NotifyInvalidImage(TCHAR* pszImageFilename);
void SaveLastDiskImage(const int drive);
const std::string& DiskGetBaseName(const int iDrive);
bool SelectImage(const int drive, LPCSTR pszFilename);
void UpdateLightStatus(HardDiskDrive* pHDD);
void SaveSnapshotHDDUnit(YamlSaveHelper& yamlSaveHelper, UINT unit);
bool LoadSnapshotHDDUnit(YamlLoadHelper& yamlLoadHelper, UINT unit);
//
BYTE m_unitNum; // b7=unit
BYTE m_command;
bool m_saveDiskImage; // Save the DiskImage name to Registry
HardDiskDrive m_hardDiskDrive[NUM_HARDDISKS];
};

View file

@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
const UINT LanguageCardUnit::kMemModeInitialState = MF_BANK2 | MF_WRITERAM; // !INTCXROM
LanguageCardUnit::LanguageCardUnit(SS_CARDTYPE type/*=CT_LanguageCardIIe*/) :
Card(type),
Card(type, kSlot0),
m_uLastRamWrite(0)
{
SetMemMainLanguageCard(NULL, true);

View file

@ -1012,6 +1012,12 @@ void RegisterIoHandler(UINT uSlot, iofunction IOReadC0, iofunction IOWriteC0, io
ExpansionRom[uSlot] = pExpansionRom;
}
void UnregisterIoHandler(UINT uSlot)
{
RegisterIoHandler(uSlot, NULL, NULL, NULL, NULL, NULL, NULL);
g_SlotInfo[uSlot].bHasCard = false;
}
// From UTAIIe:5-28: Since INTCXROM==1 then state of SLOTC3ROM is not important
static void IoHandlerCardsOut(void)
{
@ -1722,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)
{
@ -1732,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)
{
@ -1751,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)
// {
@ -1759,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, SLOT5); // $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, SLOT6); // $C600 : Disk][ card
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).InitializeIO(pCxRomPeripheral); // $C600 : Disk][ card
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
HD_Load_Rom(pCxRomPeripheral, SLOT7); // $C700 : HDD f/w
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).InitializeIO(pCxRomPeripheral);
}
// Called by:

View file

@ -60,6 +60,7 @@ const UINT kMaxExMemoryBanks = 127; // 127 * aux mem(64K) + main mem(64K) = 8MB
#endif
void RegisterIoHandler(UINT uSlot, iofunction IOReadC0, iofunction IOWriteC0, iofunction IOReadCx, iofunction IOWriteCx, LPVOID lpSlotParameter, BYTE* pExpansionRom);
void UnregisterIoHandler(UINT uSlot);
void MemDestroy ();
bool MemCheckSLOTC3ROM();

View file

@ -134,9 +134,8 @@ void M6821_Listener_A( void* objTo, BYTE byData )
//===========================================================================
CMouseInterface::CMouseInterface(UINT slot) :
Card(CT_MouseInterface),
Card(CT_MouseInterface, slot),
m_pSlotRom(NULL),
m_uSlot(slot),
m_syncEvent(slot, 0, SyncEventCallback) // use slot# as "unique" id for MouseInterfaces
{
m_6821.SetListenerB( this, M6821_Listener_B );
@ -172,13 +171,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_slot, &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);
@ -234,9 +232,9 @@ void CMouseInterface::SetSlotRom()
return;
UINT uOffset = (m_by6821B << 7) & 0x0700;
memcpy(pCxRomPeripheral+m_uSlot*256, m_pSlotRom+uOffset, 256);
memcpy(pCxRomPeripheral+m_slot*256, m_pSlotRom+uOffset, 256);
if (mem)
memcpy(mem+0xC000+m_uSlot*256, m_pSlotRom+uOffset, 256);
memcpy(mem+0xC000+m_slot*256, m_pSlotRom+uOffset, 256);
}
//===========================================================================
@ -658,7 +656,7 @@ void CMouseInterface::SaveSnapshot(class YamlSaveHelper& yamlSaveHelper)
// if (!m_bActive)
// return;
YamlSaveHelper::Slot slot(yamlSaveHelper, GetSnapshotCardName(), m_uSlot, 1);
YamlSaveHelper::Slot slot(yamlSaveHelper, GetSnapshotCardName(), m_slot, 1);
YamlSaveHelper::Label state(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE);
SaveSnapshotMC6821(yamlSaveHelper, SS_YAML_KEY_MC6821);

View file

@ -14,10 +14,10 @@ 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; }
UINT GetSlot(void) { return m_slot; }
static BYTE __stdcall IORead(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nExecutedCycles);
static BYTE __stdcall IOWrite(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nExecutedCycles);
@ -106,7 +106,6 @@ protected:
// bool m_bActive; // Mouse h/w is active within the Apple][ VM
bool m_bEnabled; // Windows' mouse events get passed to Apple]['s mouse h/w (m_bEnabled == true implies that m_bActive == true)
LPBYTE m_pSlotRom;
UINT m_uSlot;
SyncEvent m_syncEvent;
};

View file

@ -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);
}
//===========================================================================

View file

@ -6,8 +6,7 @@ class SAMCard : public Card
{
public:
SAMCard(UINT slot) :
Card(CT_SAM),
m_slot(slot)
Card(CT_SAM, slot)
{
}
virtual ~SAMCard(void) {}
@ -15,7 +14,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);
@ -24,5 +23,5 @@ public:
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
private:
UINT m_slot;
// no state
};

View file

@ -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);
}
//===========================================================================

View file

@ -7,8 +7,7 @@ class SNESMAXCard : public Card
{
public:
SNESMAXCard(UINT slot) :
Card(CT_SNESMAX),
m_slot(slot)
Card(CT_SNESMAX, slot)
{
m_buttonIndex = 0;
m_controller1Buttons = 0;
@ -22,7 +21,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);
@ -32,8 +31,6 @@ public:
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
private:
UINT m_slot;
UINT m_buttonIndex;
UINT m_controller1Buttons;
UINT m_controller2Buttons;

View file

@ -147,7 +147,10 @@ void Snapshot_GetDefaultFilenameAndPath(std::string& defaultFilename, std::strin
{
// Attempt to get a default filename/path based on harddisk plugged-in or floppy disk inserted
// . Priority given to harddisk over floppy images
HD_GetFilenameAndPathForSaveState(defaultFilename, defaultPath);
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).GetFilenameAndPathForSaveState(defaultFilename, defaultPath);
if (defaultFilename.empty())
GetCardMgr().GetDisk2CardMgr().GetFilenameAndPathForSaveState(defaultFilename, defaultPath);
}
@ -370,11 +373,11 @@ static void ParseSlots(YamlLoadHelper& yamlLoadHelper, UINT unitVersion)
GetCardMgr().Insert(slot, type);
bRes = dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion);
}
else if (card == HD_GetSnapshotCardName())
else if (card == HarddiskInterfaceCard::GetSnapshotCardName())
{
type = CT_GenericHDD;
GetCardMgr().Insert(slot, type);
bRes = HD_LoadSnapshot(yamlLoadHelper, slot, cardVersion, g_strSaveStatePath);
bRes = dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(slot)).LoadSnapshot(yamlLoadHelper, slot, cardVersion, g_strSaveStatePath);
}
else if (card == tfe_GetSnapshotCardName())
{
@ -496,9 +499,6 @@ static void Snapshot_LoadState_v2(void)
MemReset(); // Also calls CpuInitialize()
GetPravets().Reset();
HD_Reset();
HD_SetEnabled(false); // Set disabled & also removes card from slot 7
KeybReset();
GetVideo().VideoResetState();
GetVideo().SetVideoRefreshRate(VR_60HZ); // Default to 60Hz as older save-states won't contain refresh rate
@ -574,9 +574,6 @@ void Snapshot_LoadState()
//-----------------------------------------------------------------------------
// todo:
// . Uthernet card
void Snapshot_SaveState(void)
{
try
@ -646,7 +643,7 @@ void Snapshot_SaveState(void)
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(SLOT6)).SaveSnapshot(yamlSaveHelper);
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
HD_SaveSnapshot(yamlSaveHelper);
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).SaveSnapshot(yamlSaveHelper);
for (UINT slot = SLOT3; slot <= SLOT5; slot++)
{

View file

@ -65,8 +65,7 @@ SSC_DIPSW CSuperSerialCard::m_DIPSWDefault =
//===========================================================================
CSuperSerialCard::CSuperSerialCard(UINT slot) :
Card(CT_SSC),
m_uSlot(slot),
Card(CT_SSC, slot),
m_aySerialPortChoices(NULL),
m_uTCPChoiceItemIdx(0),
m_bCfgSupportDCD(false),
@ -90,7 +89,7 @@ CSuperSerialCard::CSuperSerialCard(UINT slot) :
//
char serialPortName[CSuperSerialCard::SIZEOF_SERIALCHOICE_ITEM];
std::string& regSection = RegGetConfigSlotSection(m_uSlot);
std::string& regSection = RegGetConfigSlotSection(m_slot);
RegLoadString(regSection.c_str(), REGVALUE_SERIAL_PORT_NAME, TRUE, serialPortName, sizeof(serialPortName), TEXT(""));
SetSerialPortName(serialPortName);
@ -942,7 +941,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 +951,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_slot*SSC_SLOT_FW_SIZE, pData+SSC_SLOT_FW_OFFSET, SSC_SLOT_FW_SIZE);
// Expansion ROM
if (m_pExpansionRom == NULL)
@ -966,7 +964,7 @@ void CSuperSerialCard::CommInitialize(LPBYTE pCxRomPeripheral, UINT uSlot)
//
RegisterIoHandler(uSlot, &CSuperSerialCard::SSC_IORead, &CSuperSerialCard::SSC_IOWrite, NULL, NULL, this, m_pExpansionRom);
RegisterIoHandler(m_slot, &CSuperSerialCard::SSC_IORead, &CSuperSerialCard::SSC_IOWrite, NULL, NULL, this, m_pExpansionRom);
}
//===========================================================================
@ -1394,7 +1392,7 @@ void CSuperSerialCard::SetSerialPortName(const char* pSerialPortName)
void CSuperSerialCard::SetRegistrySerialPortName(void)
{
std::string& regSection = RegGetConfigSlotSection(m_uSlot);
std::string& regSection = RegGetConfigSlotSection(m_slot);
RegSaveString(regSection.c_str(), REGVALUE_SERIAL_PORT_NAME, TRUE, GetSerialPortName());
}
@ -1448,7 +1446,7 @@ void CSuperSerialCard::SaveSnapshotDIPSW(YamlSaveHelper& yamlSaveHelper, std::st
void CSuperSerialCard::SaveSnapshot(YamlSaveHelper& yamlSaveHelper)
{
YamlSaveHelper::Slot slot(yamlSaveHelper, GetSnapshotCardName(), m_uSlot, kUNIT_VERSION);
YamlSaveHelper::Slot slot(yamlSaveHelper, GetSnapshotCardName(), m_slot, kUNIT_VERSION);
YamlSaveHelper::Label unit(yamlSaveHelper, "%s:\n", SS_YAML_KEY_STATE);
SaveSnapshotDIPSW(yamlSaveHelper, SS_YAML_KEY_DIPSWDEFAULT, m_DIPSWDefault);

View file

@ -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);
@ -141,7 +141,6 @@ private:
OVERLAPPED m_o;
BYTE* m_pExpansionRom;
UINT m_uSlot;
bool m_bCfgSupportDCD;
UINT m_uDTR;

View file

@ -269,11 +269,6 @@ void LoadConfiguration(void)
tfe_init(true);
}
}
else if (slot == SLOT7)
{
if ((SS_CARDTYPE)dwTmp == CT_GenericHDD) // TODO: move this to when HarddiskInterfaceCard object is instantiated
HD_SetEnabled(true, false);
}
}
else // legacy (AppleWin 1.30.3 or earlier)
{
@ -298,7 +293,7 @@ void LoadConfiguration(void)
else if (slot == SLOT5 && REGLOAD(TEXT(REGVALUE_SLOT5), &dwTmp))
GetCardMgr().Insert(SLOT5, (SS_CARDTYPE)dwTmp);
else if (slot == SLOT7 && REGLOAD(TEXT(REGVALUE_HDD_ENABLED), &dwTmp))
HD_SetEnabled(dwTmp ? true : false);
GetCardMgr().Insert(SLOT7, (SS_CARDTYPE)dwTmp);
}
}
@ -316,8 +311,11 @@ void LoadConfiguration(void)
GetCurrentDirectory(sizeof(szFilename), szFilename);
SetCurrentImageDir(szFilename);
HD_LoadLastDiskImage(HARDDISK_1);
HD_LoadLastDiskImage(HARDDISK_2);
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
{
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).LoadLastDiskImage(HARDDISK_1);
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).LoadLastDiskImage(HARDDISK_2);
}
//
@ -403,16 +401,20 @@ static bool DoDiskInsert(const UINT slot, const int nDrive, LPCSTR szFileName)
static bool DoHardDiskInsert(const int nDrive, LPCSTR szFileName)
{
_ASSERT(GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD);
if (GetCardMgr().QuerySlot(SLOT7) != CT_GenericHDD)
return false;
if (szFileName[0] == '\0')
{
HD_Unplug(nDrive);
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).Unplug(nDrive);
return true;
}
std::string strPathName = GetFullPath(szFileName);
if (strPathName.empty()) return false;
BOOL bRes = HD_Insert(nDrive, strPathName);
BOOL bRes = dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).Insert(nDrive, strPathName);
bool res = (bRes == TRUE);
if (res)
SetCurrentDir(strPathName);
@ -456,7 +458,8 @@ void InsertHardDisks(LPCSTR szImageName_harddisk[NUM_HARDDISKS], bool& bBoot)
if (!szImageName_harddisk[HARDDISK_1] && !szImageName_harddisk[HARDDISK_2])
return;
HD_SetEnabled(true); // Enable the Harddisk controller card
if (GetCardMgr().QuerySlot(SLOT7) != CT_GenericHDD)
GetCardMgr().Insert(SLOT7, CT_GenericHDD); // Enable the Harddisk controller card
bool bRes = true;
@ -478,11 +481,6 @@ void InsertHardDisks(LPCSTR szImageName_harddisk[NUM_HARDDISKS], bool& bBoot)
GetFrame().FrameMessageBox("Failed to insert harddisk(s) - see log file", "Warning", MB_ICONASTERISK | MB_OK);
}
void UnplugHardDiskControllerCard(void)
{
HD_SetEnabled(false);
}
void GetAppleWindowTitle()
{
switch (g_Apple2Type)
@ -543,7 +541,8 @@ void GetAppleWindowTitle()
void ResetMachineState()
{
GetCardMgr().GetDisk2CardMgr().Reset(true);
HD_Reset();
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).Reset(true);
g_bFullSpeed = 0; // Might've hit reset in middle of InternalCpuExecute() - so beep may get (partially) muted
MemReset(); // calls CpuInitialize(), CNoSlotClock.Reset()
@ -597,7 +596,8 @@ void CtrlReset()
GetPravets().Reset();
GetCardMgr().GetDisk2CardMgr().Reset();
HD_Reset();
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).Reset(true);
KeybReset();
if (GetCardMgr().IsSSCInstalled())
GetCardMgr().GetSSC()->CommReset();

View file

@ -7,7 +7,6 @@
void LoadConfiguration();
void InsertFloppyDisks(const UINT slot, LPCSTR szImageName_drive[NUM_DRIVES], bool driveConnected[NUM_DRIVES], bool& bBoot);
void InsertHardDisks(LPCSTR szImageName_harddisk[NUM_HARDDISKS], bool& bBoot);
void UnplugHardDiskControllerCard(void);
void GetAppleWindowTitle();
void CtrlReset();

View file

@ -782,7 +782,7 @@ static void RepeatInitialization(void)
if (g_cmdLine.bSlotEmpty[SLOT7])
{
HD_SetEnabled(false); // Disable HDD controller, and persist this to Registry/conf.ini (consistent with other '-sn empty' cmds)
GetCardMgr().Remove(SLOT7); // Disable HDD controller, and persist this to Registry/conf.ini (consistent with other '-sn empty' cmds)
Snapshot_UpdatePath(); // If save-state's filename is a harddisk, and the floppy is in the same path, then the filename won't be updated
}
}
@ -821,7 +821,8 @@ static void RepeatInitialization(void)
// Need to test if it's safe to call ResetMachineState(). In the meantime, just call Disk2Card's Reset():
GetCardMgr().GetDisk2CardMgr().Reset(true); // Switch from a booting A][+ to a non-autostart A][, so need to turn off floppy motor
LogFileOutput("Main: DiskReset()\n");
HD_Reset(); // GH#515
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).Reset(true); // GH#515
LogFileOutput("Main: HDDReset()\n");
if (!g_bSysClkOK)
@ -916,7 +917,7 @@ static void Shutdown(void)
CloseHandle(g_hCustomRom);
if (g_cmdLine.bSlot7EmptyOnExit)
UnplugHardDiskControllerCard();
GetCardMgr().Remove(SLOT7);
}
IPropertySheet& GetPropertySheet(void)

View file

@ -741,11 +741,9 @@ void Win32Frame::DrawStatusArea (HDC passdc, int drawflags)
int y = buttony+BUTTONS*BUTTONCY+1;
const bool bCaps = KeybGetCapsStatus();
#if HD_LED
// 1.19.0.0 Hard Disk Status/Indicator Light
Disk_Status_e eHardDriveStatus = DISK_STATUS_OFF;
HD_GetLightStatus(&eHardDriveStatus);
#endif
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).GetLightStatus(&eHardDriveStatus);
if (g_bIsFullScreen)
{
@ -764,11 +762,9 @@ void Win32Frame::DrawStatusArea (HDC passdc, int drawflags)
FrameDrawDiskStatus(dc);
}
#if HD_LED
SetTextAlign(dc, TA_RIGHT | TA_TOP);
SetTextColor(dc, g_aDiskFullScreenColorsLED[ eHardDriveStatus ] );
TextOut(dc,x+23,y+2,TEXT("H"),1);
#endif
if (!IS_APPLE2)
{
@ -849,11 +845,8 @@ void Win32Frame::DrawStatusArea (HDC passdc, int drawflags)
case A2TYPE_PRAVETS8A : DrawBitmapRect(dc,x+31,y+17,&rCapsLed,g_hCapsBitmapP8 [bCaps != 0]); break;
}
#if HD_LED
// 1.19.0.0 Hard Disk Status/Indicator Light
RECT rDiskLed = {0,0,8,8};
DrawBitmapRect(dc,x+12,y+18,&rDiskLed,g_hDiskWindowedLED[eHardDriveStatus]);
#endif
}
}
@ -968,7 +961,8 @@ LRESULT Win32Frame::WndProc(
DebugDestroy();
if (!g_bRestart) {
GetCardMgr().GetDisk2CardMgr().Destroy();
HD_Destroy();
if (GetCardMgr().QuerySlot(SLOT7) == CT_GenericHDD)
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(SLOT7)).Destroy();
}
PrintDestroy();
if (GetCardMgr().IsSSCInstalled())

View file

@ -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);

View file

@ -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);