mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-25 07:32:53 +00:00
Class-ify disk.cpp into DiskIIInterfaceCard
This commit is contained in:
parent
4db23c10dc
commit
e7d6eac04d
@ -105,6 +105,7 @@ int g_nMemoryClearType = MIP_FF_FF_00_00; // Note: -1 = random MIP in Memory.c
|
|||||||
IPropertySheet& sg_PropertySheet = * new CPropertySheet;
|
IPropertySheet& sg_PropertySheet = * new CPropertySheet;
|
||||||
CSuperSerialCard sg_SSC;
|
CSuperSerialCard sg_SSC;
|
||||||
CMouseInterface sg_Mouse;
|
CMouseInterface sg_Mouse;
|
||||||
|
DiskIIInterfaceCard sg_DiskIICard;
|
||||||
|
|
||||||
SS_CARDTYPE g_Slot0 = CT_LanguageCard; // Just for Apple II or II+ or similar clones
|
SS_CARDTYPE g_Slot0 = CT_LanguageCard; // Just for Apple II or II+ or similar clones
|
||||||
SS_CARDTYPE g_Slot4 = CT_Empty;
|
SS_CARDTYPE g_Slot4 = CT_Empty;
|
||||||
@ -269,7 +270,7 @@ static void ContinueExecution(void)
|
|||||||
const bool bWasFullSpeed = g_bFullSpeed;
|
const bool bWasFullSpeed = g_bFullSpeed;
|
||||||
g_bFullSpeed = (g_dwSpeed == SPEED_MAX) ||
|
g_bFullSpeed = (g_dwSpeed == SPEED_MAX) ||
|
||||||
bScrollLock_FullSpeed ||
|
bScrollLock_FullSpeed ||
|
||||||
(Disk_IsConditionForFullSpeed() && !Spkr_IsActive() && !MB_IsActive()) ||
|
(sg_DiskIICard.Disk_IsConditionForFullSpeed() && !Spkr_IsActive() && !MB_IsActive()) ||
|
||||||
IsDebugSteppingAtFullSpeed();
|
IsDebugSteppingAtFullSpeed();
|
||||||
|
|
||||||
if (g_bFullSpeed)
|
if (g_bFullSpeed)
|
||||||
@ -316,7 +317,7 @@ static void ContinueExecution(void)
|
|||||||
const DWORD uActualCyclesExecuted = CpuExecute(uCyclesToExecute, bVideoUpdate);
|
const DWORD uActualCyclesExecuted = CpuExecute(uCyclesToExecute, bVideoUpdate);
|
||||||
g_dwCyclesThisFrame += uActualCyclesExecuted;
|
g_dwCyclesThisFrame += uActualCyclesExecuted;
|
||||||
|
|
||||||
DiskUpdateDriveState(uActualCyclesExecuted);
|
sg_DiskIICard.DiskUpdateDriveState(uActualCyclesExecuted);
|
||||||
JoyUpdateButtonLatch(nExecutionPeriodUsec); // Button latch time is independent of CPU clock frequency
|
JoyUpdateButtonLatch(nExecutionPeriodUsec); // Button latch time is independent of CPU clock frequency
|
||||||
PrintUpdate(uActualCyclesExecuted);
|
PrintUpdate(uActualCyclesExecuted);
|
||||||
|
|
||||||
@ -624,7 +625,7 @@ void LoadConfiguration(void)
|
|||||||
|
|
||||||
DWORD dwEnhanceDisk;
|
DWORD dwEnhanceDisk;
|
||||||
REGLOAD(TEXT(REGVALUE_ENHANCE_DISK_SPEED), &dwEnhanceDisk);
|
REGLOAD(TEXT(REGVALUE_ENHANCE_DISK_SPEED), &dwEnhanceDisk);
|
||||||
Disk_SetEnhanceDisk(dwEnhanceDisk ? true : false);
|
sg_DiskIICard.Disk_SetEnhanceDisk(dwEnhanceDisk ? true : false);
|
||||||
|
|
||||||
Config_Load_Video();
|
Config_Load_Video();
|
||||||
|
|
||||||
@ -713,8 +714,8 @@ void LoadConfiguration(void)
|
|||||||
GetCurrentDirectory(sizeof(szFilename), szFilename);
|
GetCurrentDirectory(sizeof(szFilename), szFilename);
|
||||||
SetCurrentImageDir(szFilename);
|
SetCurrentImageDir(szFilename);
|
||||||
|
|
||||||
Disk_LoadLastDiskImage(DRIVE_1);
|
sg_DiskIICard.Disk_LoadLastDiskImage(DRIVE_1);
|
||||||
Disk_LoadLastDiskImage(DRIVE_2);
|
sg_DiskIICard.Disk_LoadLastDiskImage(DRIVE_2);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -1061,7 +1062,7 @@ static bool DoDiskInsert(const int nDrive, LPCSTR szFileName)
|
|||||||
std::string strPathName = GetFullPath(szFileName);
|
std::string strPathName = GetFullPath(szFileName);
|
||||||
if (strPathName.empty()) return false;
|
if (strPathName.empty()) return false;
|
||||||
|
|
||||||
ImageError_e Error = DiskInsert(nDrive, strPathName.c_str(), IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
|
ImageError_e Error = sg_DiskIICard.DiskInsert(nDrive, strPathName.c_str(), IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
|
||||||
return Error == eIMAGE_ERROR_NONE;
|
return Error == eIMAGE_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1521,7 +1522,7 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||||||
ImageInitialize();
|
ImageInitialize();
|
||||||
LogFileOutput("Init: ImageInitialize()\n");
|
LogFileOutput("Init: ImageInitialize()\n");
|
||||||
|
|
||||||
DiskInitialize();
|
sg_DiskIICard.DiskInitialize();
|
||||||
LogFileOutput("Init: DiskInitialize()\n");
|
LogFileOutput("Init: DiskInitialize()\n");
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1615,7 +1616,7 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Need to test if it's safe to call ResetMachineState(). In the meantime, just call DiskReset():
|
// Need to test if it's safe to call ResetMachineState(). In the meantime, just call DiskReset():
|
||||||
DiskReset(); // Switch from a booting A][+ to a non-autostart A][, so need to turn off floppy motor
|
sg_DiskIICard.DiskReset(); // Switch from a booting A][+ to a non-autostart A][, so need to turn off floppy motor
|
||||||
LogFileOutput("Main: DiskReset()\n");
|
LogFileOutput("Main: DiskReset()\n");
|
||||||
HD_Reset(); // GH#515
|
HD_Reset(); // GH#515
|
||||||
LogFileOutput("Main: HDDReset()\n");
|
LogFileOutput("Main: HDDReset()\n");
|
||||||
|
@ -130,19 +130,19 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l
|
|||||||
|
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_DISKTYPE, m_discchoices, Disk_GetEnhanceDisk() ? 1 : 0);
|
m_PropertySheetHelper.FillComboBox(hWnd, IDC_DISKTYPE, m_discchoices, sg_DiskIICard.Disk_GetEnhanceDisk() ? 1 : 0);
|
||||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK1, m_defaultDiskOptions, -1);
|
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK1, m_defaultDiskOptions, -1);
|
||||||
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK2, m_defaultDiskOptions, -1);
|
m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMBO_DISK2, m_defaultDiskOptions, -1);
|
||||||
|
|
||||||
if (strlen(DiskGetFullName(DRIVE_1)) > 0)
|
if (strlen(sg_DiskIICard.DiskGetFullName(DRIVE_1)) > 0)
|
||||||
{
|
{
|
||||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_INSERTSTRING, 0, (LPARAM)DiskGetFullName(DRIVE_1));
|
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_INSERTSTRING, 0, (LPARAM)sg_DiskIICard.DiskGetFullName(DRIVE_1));
|
||||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_SETCURSEL, 0, 0);
|
SendDlgItemMessage(hWnd, IDC_COMBO_DISK1, CB_SETCURSEL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(DiskGetFullName(DRIVE_2)) > 0)
|
if (strlen(sg_DiskIICard.DiskGetFullName(DRIVE_2)) > 0)
|
||||||
{
|
{
|
||||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_INSERTSTRING, 0, (LPARAM)DiskGetFullName(DRIVE_2));
|
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_INSERTSTRING, 0, (LPARAM)sg_DiskIICard.DiskGetFullName(DRIVE_2));
|
||||||
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_SETCURSEL, 0, 0);
|
SendDlgItemMessage(hWnd, IDC_COMBO_DISK2, CB_SETCURSEL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,9 +187,9 @@ void CPageDisk::InitComboHDD(HWND hWnd)
|
|||||||
void CPageDisk::DlgOK(HWND hWnd)
|
void CPageDisk::DlgOK(HWND hWnd)
|
||||||
{
|
{
|
||||||
const bool bNewEnhanceDisk = SendDlgItemMessage(hWnd, IDC_DISKTYPE,CB_GETCURSEL, 0, 0) ? true : false;
|
const bool bNewEnhanceDisk = SendDlgItemMessage(hWnd, IDC_DISKTYPE,CB_GETCURSEL, 0, 0) ? true : false;
|
||||||
if (bNewEnhanceDisk != Disk_GetEnhanceDisk())
|
if (bNewEnhanceDisk != sg_DiskIICard.Disk_GetEnhanceDisk())
|
||||||
{
|
{
|
||||||
Disk_SetEnhanceDisk(bNewEnhanceDisk);
|
sg_DiskIICard.Disk_SetEnhanceDisk(bNewEnhanceDisk);
|
||||||
REGSAVE(TEXT(REGVALUE_ENHANCE_DISK_SPEED), (DWORD)bNewEnhanceDisk);
|
REGSAVE(TEXT(REGVALUE_ENHANCE_DISK_SPEED), (DWORD)bNewEnhanceDisk);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ void CPageDisk::HandleDiskCombo(HWND hWnd, UINT driveSelected, UINT comboSelecte
|
|||||||
if (dwComboSelection == dwOpenDialogIndex)
|
if (dwComboSelection == dwOpenDialogIndex)
|
||||||
{
|
{
|
||||||
EnableDisk(hWnd, FALSE); // Prevent multiple Selection dialogs to be triggered
|
EnableDisk(hWnd, FALSE); // Prevent multiple Selection dialogs to be triggered
|
||||||
bool bRes = DiskSelect(driveSelected);
|
bool bRes = sg_DiskIICard.DiskSelect(driveSelected);
|
||||||
EnableDisk(hWnd, TRUE);
|
EnableDisk(hWnd, TRUE);
|
||||||
|
|
||||||
if (!bRes)
|
if (!bRes)
|
||||||
@ -316,13 +316,13 @@ void CPageDisk::HandleDiskCombo(HWND hWnd, UINT driveSelected, UINT comboSelecte
|
|||||||
SendDlgItemMessage(hWnd, comboSelected, CB_DELETESTRING, 0, 0);
|
SendDlgItemMessage(hWnd, comboSelected, CB_DELETESTRING, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendDlgItemMessage(hWnd, comboSelected, CB_INSERTSTRING, 0, (LPARAM)DiskGetFullName(driveSelected));
|
SendDlgItemMessage(hWnd, comboSelected, CB_INSERTSTRING, 0, (LPARAM)sg_DiskIICard.DiskGetFullName(driveSelected));
|
||||||
SendDlgItemMessage(hWnd, comboSelected, CB_SETCURSEL, 0, 0);
|
SendDlgItemMessage(hWnd, comboSelected, CB_SETCURSEL, 0, 0);
|
||||||
|
|
||||||
// If the FD was in the other combo, remove now
|
// If the FD was in the other combo, remove now
|
||||||
DWORD comboOther = (comboSelected == IDC_COMBO_DISK1) ? IDC_COMBO_DISK2 : IDC_COMBO_DISK1;
|
DWORD comboOther = (comboSelected == IDC_COMBO_DISK1) ? IDC_COMBO_DISK2 : IDC_COMBO_DISK1;
|
||||||
|
|
||||||
DWORD duplicated = (DWORD)SendDlgItemMessage(hWnd, comboOther, CB_FINDSTRINGEXACT, -1, (LPARAM)DiskGetFullName(driveSelected));
|
DWORD duplicated = (DWORD)SendDlgItemMessage(hWnd, comboOther, CB_FINDSTRINGEXACT, -1, (LPARAM)sg_DiskIICard.DiskGetFullName(driveSelected));
|
||||||
if (duplicated != CB_ERR)
|
if (duplicated != CB_ERR)
|
||||||
{
|
{
|
||||||
SendDlgItemMessage(hWnd, comboOther, CB_DELETESTRING, duplicated, 0);
|
SendDlgItemMessage(hWnd, comboOther, CB_DELETESTRING, duplicated, 0);
|
||||||
@ -337,7 +337,7 @@ void CPageDisk::HandleDiskCombo(HWND hWnd, UINT driveSelected, UINT comboSelecte
|
|||||||
if (RemovalConfirmation(uCommand))
|
if (RemovalConfirmation(uCommand))
|
||||||
{
|
{
|
||||||
// Eject selected disk
|
// Eject selected disk
|
||||||
DiskEject(driveSelected);
|
sg_DiskIICard.DiskEject(driveSelected);
|
||||||
// Remove drive from list
|
// Remove drive from list
|
||||||
SendDlgItemMessage(hWnd, comboSelected, CB_DELETESTRING, 0, 0);
|
SendDlgItemMessage(hWnd, comboSelected, CB_DELETESTRING, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ void CPropertySheetHelper::SaveStateUpdate()
|
|||||||
|
|
||||||
void CPropertySheetHelper::GetDiskBaseNameWithAWS(TCHAR* pszFilename)
|
void CPropertySheetHelper::GetDiskBaseNameWithAWS(TCHAR* pszFilename)
|
||||||
{
|
{
|
||||||
LPCTSTR pDiskName = DiskGetBaseName(DRIVE_1);
|
LPCTSTR pDiskName = sg_DiskIICard.DiskGetBaseName(DRIVE_1);
|
||||||
if (pDiskName && pDiskName[0])
|
if (pDiskName && pDiskName[0])
|
||||||
{
|
{
|
||||||
strcpy(pszFilename, pDiskName);
|
strcpy(pszFilename, pDiskName);
|
||||||
|
@ -3727,15 +3727,15 @@ Update_t CmdDisk ( int nArgs)
|
|||||||
if (nArgs > 2)
|
if (nArgs > 2)
|
||||||
goto _Help;
|
goto _Help;
|
||||||
|
|
||||||
int drive = DiskGetCurrentDrive() + 1;
|
int drive = sg_DiskIICard.DiskGetCurrentDrive() + 1;
|
||||||
char buffer[200] = "";
|
char buffer[200] = "";
|
||||||
ConsoleBufferPushFormat(buffer, "D%d at T$%X (%d), phase $%X, offset $%X, %s",
|
ConsoleBufferPushFormat(buffer, "D%d at T$%X (%d), phase $%X, offset $%X, %s",
|
||||||
drive,
|
drive,
|
||||||
DiskGetCurrentTrack(),
|
sg_DiskIICard.DiskGetCurrentTrack(),
|
||||||
DiskGetCurrentTrack(),
|
sg_DiskIICard.DiskGetCurrentTrack(),
|
||||||
DiskGetCurrentPhase(),
|
sg_DiskIICard.DiskGetCurrentPhase(),
|
||||||
DiskGetCurrentOffset(),
|
sg_DiskIICard.DiskGetCurrentOffset(),
|
||||||
DiskGetCurrentState());
|
sg_DiskIICard.DiskGetCurrentState());
|
||||||
|
|
||||||
return ConsoleUpdate();
|
return ConsoleUpdate();
|
||||||
}
|
}
|
||||||
@ -3762,7 +3762,7 @@ Update_t CmdDisk ( int nArgs)
|
|||||||
if (nArgs > 2)
|
if (nArgs > 2)
|
||||||
goto _Help;
|
goto _Help;
|
||||||
|
|
||||||
DiskEject( iDrive );
|
sg_DiskIICard.DiskEject( iDrive );
|
||||||
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
|
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3776,7 +3776,7 @@ Update_t CmdDisk ( int nArgs)
|
|||||||
if (nArgs == 3)
|
if (nArgs == 3)
|
||||||
bProtect = g_aArgs[ 3 ].nValue ? true : false;
|
bProtect = g_aArgs[ 3 ].nValue ? true : false;
|
||||||
|
|
||||||
DiskSetProtect( iDrive, bProtect );
|
sg_DiskIICard.DiskSetProtect( iDrive, bProtect );
|
||||||
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
|
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3787,7 +3787,7 @@ Update_t CmdDisk ( int nArgs)
|
|||||||
LPCTSTR pDiskName = g_aArgs[ 3 ].sArg;
|
LPCTSTR pDiskName = g_aArgs[ 3 ].sArg;
|
||||||
|
|
||||||
// DISK # "Diskname"
|
// DISK # "Diskname"
|
||||||
DiskInsert( iDrive, pDiskName, IMAGE_FORCE_WRITE_PROTECTED, IMAGE_DONT_CREATE );
|
sg_DiskIICard.DiskInsert( iDrive, pDiskName, IMAGE_FORCE_WRITE_PROTECTED, IMAGE_DONT_CREATE );
|
||||||
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
|
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
196
source/Disk.cpp
196
source/Disk.cpp
@ -99,21 +99,21 @@ static bool enhancedisk = true;
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
bool Disk_GetEnhanceDisk(void) { return enhancedisk; }
|
bool DiskIIInterfaceCard::Disk_GetEnhanceDisk(void) { return enhancedisk; }
|
||||||
void Disk_SetEnhanceDisk(bool bEnhanceDisk) { enhancedisk = bEnhanceDisk; }
|
void DiskIIInterfaceCard::Disk_SetEnhanceDisk(bool bEnhanceDisk) { enhancedisk = bEnhanceDisk; }
|
||||||
|
|
||||||
int DiskGetCurrentDrive(void) { return currdrive; }
|
int DiskIIInterfaceCard::DiskGetCurrentDrive(void) { return currdrive; }
|
||||||
int DiskGetCurrentTrack(void) { return g_aFloppyDrive[currdrive].track; }
|
int DiskIIInterfaceCard::DiskGetCurrentTrack(void) { return g_aFloppyDrive[currdrive].track; }
|
||||||
int DiskGetCurrentPhase(void) { return g_aFloppyDrive[currdrive].phase; }
|
int DiskIIInterfaceCard::DiskGetCurrentPhase(void) { return g_aFloppyDrive[currdrive].phase; }
|
||||||
int DiskGetCurrentOffset(void) { return g_aFloppyDrive[currdrive].disk.byte; }
|
int DiskIIInterfaceCard::DiskGetCurrentOffset(void) { return g_aFloppyDrive[currdrive].disk.byte; }
|
||||||
int DiskGetTrack( int drive ) { return g_aFloppyDrive[ drive ].track; }
|
int DiskIIInterfaceCard::DiskGetTrack( int drive ) { return g_aFloppyDrive[ drive ].track; }
|
||||||
|
|
||||||
const char* DiskGetDiskPathFilename(const int iDrive)
|
const char* DiskIIInterfaceCard::DiskGetDiskPathFilename(const int iDrive)
|
||||||
{
|
{
|
||||||
return g_aFloppyDrive[iDrive].disk.fullname;
|
return g_aFloppyDrive[iDrive].disk.fullname;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DiskGetCurrentState(void)
|
const char* DiskIIInterfaceCard::DiskGetCurrentState(void)
|
||||||
{
|
{
|
||||||
if (g_aFloppyDrive[currdrive].disk.imagehandle == NULL)
|
if (g_aFloppyDrive[currdrive].disk.imagehandle == NULL)
|
||||||
return "Empty";
|
return "Empty";
|
||||||
@ -148,7 +148,7 @@ const char* DiskGetCurrentState(void)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void Disk_LoadLastDiskImage(const int iDrive)
|
void DiskIIInterfaceCard::Disk_LoadLastDiskImage(const int iDrive)
|
||||||
{
|
{
|
||||||
_ASSERT(iDrive == DRIVE_1 || iDrive == DRIVE_2);
|
_ASSERT(iDrive == DRIVE_1 || iDrive == DRIVE_2);
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ void Disk_LoadLastDiskImage(const int iDrive)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void Disk_SaveLastDiskImage(const int iDrive)
|
void DiskIIInterfaceCard::Disk_SaveLastDiskImage(const int iDrive)
|
||||||
{
|
{
|
||||||
_ASSERT(iDrive == DRIVE_1 || iDrive == DRIVE_2);
|
_ASSERT(iDrive == DRIVE_1 || iDrive == DRIVE_2);
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ void Disk_SaveLastDiskImage(const int iDrive)
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
// Called by DiskControlMotor() & DiskEnable()
|
// Called by DiskControlMotor() & DiskEnable()
|
||||||
static void CheckSpinning(const ULONG nExecutedCycles)
|
void DiskIIInterfaceCard::CheckSpinning(const ULONG nExecutedCycles)
|
||||||
{
|
{
|
||||||
DWORD modechange = (floppymotoron && !g_aFloppyDrive[currdrive].spinning);
|
DWORD modechange = (floppymotoron && !g_aFloppyDrive[currdrive].spinning);
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ static void CheckSpinning(const ULONG nExecutedCycles)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static Disk_Status_e GetDriveLightStatus(const int iDrive)
|
Disk_Status_e DiskIIInterfaceCard::GetDriveLightStatus(const int iDrive)
|
||||||
{
|
{
|
||||||
if (IsDriveValid( iDrive ))
|
if (IsDriveValid( iDrive ))
|
||||||
{
|
{
|
||||||
@ -248,14 +248,14 @@ static Disk_Status_e GetDriveLightStatus(const int iDrive)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static bool IsDriveValid(const int iDrive)
|
bool DiskIIInterfaceCard::IsDriveValid(const int iDrive)
|
||||||
{
|
{
|
||||||
return (iDrive >= 0 && iDrive < NUM_DRIVES);
|
return (iDrive >= 0 && iDrive < NUM_DRIVES);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static void AllocTrack(const int iDrive)
|
void DiskIIInterfaceCard::AllocTrack(const int iDrive)
|
||||||
{
|
{
|
||||||
Disk_t* pFloppy = &g_aFloppyDrive[iDrive].disk;
|
Disk_t* pFloppy = &g_aFloppyDrive[iDrive].disk;
|
||||||
pFloppy->trackimage = (LPBYTE)VirtualAlloc(NULL, NIBBLES_PER_TRACK, MEM_COMMIT, PAGE_READWRITE);
|
pFloppy->trackimage = (LPBYTE)VirtualAlloc(NULL, NIBBLES_PER_TRACK, MEM_COMMIT, PAGE_READWRITE);
|
||||||
@ -263,7 +263,7 @@ static void AllocTrack(const int iDrive)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static void ReadTrack(const int iDrive)
|
void DiskIIInterfaceCard::ReadTrack(const int iDrive)
|
||||||
{
|
{
|
||||||
if (! IsDriveValid( iDrive ))
|
if (! IsDriveValid( iDrive ))
|
||||||
return;
|
return;
|
||||||
@ -290,7 +290,8 @@ static void ReadTrack(const int iDrive)
|
|||||||
pDrive->track,
|
pDrive->track,
|
||||||
pDrive->phase,
|
pDrive->phase,
|
||||||
pFloppy->trackimage,
|
pFloppy->trackimage,
|
||||||
&pFloppy->nibbles);
|
&pFloppy->nibbles,
|
||||||
|
enhancedisk);
|
||||||
|
|
||||||
pFloppy->byte = 0;
|
pFloppy->byte = 0;
|
||||||
pFloppy->trackimagedata = (pFloppy->nibbles != 0);
|
pFloppy->trackimagedata = (pFloppy->nibbles != 0);
|
||||||
@ -299,7 +300,7 @@ static void ReadTrack(const int iDrive)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static void RemoveDisk(const int iDrive)
|
void DiskIIInterfaceCard::RemoveDisk(const int iDrive)
|
||||||
{
|
{
|
||||||
Disk_t* pFloppy = &g_aFloppyDrive[iDrive].disk;
|
Disk_t* pFloppy = &g_aFloppyDrive[iDrive].disk;
|
||||||
|
|
||||||
@ -328,7 +329,7 @@ static void RemoveDisk(const int iDrive)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static void WriteTrack(const int iDrive)
|
void DiskIIInterfaceCard::WriteTrack(const int iDrive)
|
||||||
{
|
{
|
||||||
Drive_t* pDrive = &g_aFloppyDrive[ iDrive ];
|
Drive_t* pDrive = &g_aFloppyDrive[ iDrive ];
|
||||||
Disk_t* pFloppy = &pDrive->disk;
|
Disk_t* pFloppy = &pDrive->disk;
|
||||||
@ -355,7 +356,7 @@ static void WriteTrack(const int iDrive)
|
|||||||
pFloppy->trackimagedirty = false;
|
pFloppy->trackimagedirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiskFlushCurrentTrack(const int iDrive)
|
void DiskIIInterfaceCard::DiskFlushCurrentTrack(const int iDrive)
|
||||||
{
|
{
|
||||||
Disk_t* pFloppy = &g_aFloppyDrive[iDrive].disk;
|
Disk_t* pFloppy = &g_aFloppyDrive[iDrive].disk;
|
||||||
|
|
||||||
@ -363,13 +364,9 @@ void DiskFlushCurrentTrack(const int iDrive)
|
|||||||
WriteTrack(iDrive);
|
WriteTrack(iDrive);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// ----- ALL GLOBALLY ACCESSIBLE FUNCTIONS ARE BELOW THIS LINE -----
|
|
||||||
//
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void DiskBoot(void)
|
void DiskIIInterfaceCard::DiskBoot(void)
|
||||||
{
|
{
|
||||||
// THIS FUNCTION RELOADS A PROGRAM IMAGE IF ONE IS LOADED IN DRIVE ONE.
|
// THIS FUNCTION RELOADS A PROGRAM IMAGE IF ONE IS LOADED IN DRIVE ONE.
|
||||||
// IF A DISK IMAGE OR NO IMAGE IS LOADED IN DRIVE ONE, IT DOES NOTHING.
|
// IF A DISK IMAGE OR NO IMAGE IS LOADED IN DRIVE ONE, IT DOES NOTHING.
|
||||||
@ -379,7 +376,7 @@ void DiskBoot(void)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static void __stdcall DiskControlMotor(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles)
|
void __stdcall DiskIIInterfaceCard::DiskControlMotor(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles)
|
||||||
{
|
{
|
||||||
BOOL newState = address & 1;
|
BOOL newState = address & 1;
|
||||||
|
|
||||||
@ -397,7 +394,7 @@ static void __stdcall DiskControlMotor(WORD, WORD address, BYTE, BYTE, ULONG uEx
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static void __stdcall DiskControlStepper(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles)
|
void __stdcall DiskIIInterfaceCard::DiskControlStepper(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles)
|
||||||
{
|
{
|
||||||
Drive_t* pDrive = &g_aFloppyDrive[currdrive];
|
Drive_t* pDrive = &g_aFloppyDrive[currdrive];
|
||||||
Disk_t* pFloppy = &pDrive->disk;
|
Disk_t* pFloppy = &pDrive->disk;
|
||||||
@ -484,7 +481,7 @@ static void __stdcall DiskControlStepper(WORD, WORD address, BYTE, BYTE, ULONG u
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void DiskDestroy(void)
|
void DiskIIInterfaceCard::DiskDestroy(void)
|
||||||
{
|
{
|
||||||
g_bSaveDiskImage = false;
|
g_bSaveDiskImage = false;
|
||||||
RemoveDisk(DRIVE_1);
|
RemoveDisk(DRIVE_1);
|
||||||
@ -497,7 +494,7 @@ void DiskDestroy(void)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static void __stdcall DiskEnable(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles)
|
void __stdcall DiskIIInterfaceCard::DiskEnable(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles)
|
||||||
{
|
{
|
||||||
currdrive = address & 1;
|
currdrive = address & 1;
|
||||||
#if LOG_DISK_ENABLE_DRIVE
|
#if LOG_DISK_ENABLE_DRIVE
|
||||||
@ -510,7 +507,7 @@ static void __stdcall DiskEnable(WORD, WORD address, BYTE, BYTE, ULONG uExecuted
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void DiskEject(const int iDrive)
|
void DiskIIInterfaceCard::DiskEject(const int iDrive)
|
||||||
{
|
{
|
||||||
if (IsDriveValid(iDrive))
|
if (IsDriveValid(iDrive))
|
||||||
{
|
{
|
||||||
@ -522,14 +519,14 @@ void DiskEject(const int iDrive)
|
|||||||
|
|
||||||
// Return the file or zip name
|
// Return the file or zip name
|
||||||
// . Used by Property Sheet Page (Disk)
|
// . Used by Property Sheet Page (Disk)
|
||||||
LPCTSTR DiskGetFullName(const int iDrive)
|
LPCTSTR DiskIIInterfaceCard::DiskGetFullName(const int iDrive)
|
||||||
{
|
{
|
||||||
return g_aFloppyDrive[iDrive].disk.fullname;
|
return g_aFloppyDrive[iDrive].disk.fullname;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the filename
|
// Return the filename
|
||||||
// . Used by Drive Buttons' tooltips
|
// . Used by Drive Buttons' tooltips
|
||||||
LPCTSTR DiskGetFullDiskFilename(const int iDrive)
|
LPCTSTR DiskIIInterfaceCard::DiskGetFullDiskFilename(const int iDrive)
|
||||||
{
|
{
|
||||||
if (!g_aFloppyDrive[iDrive].disk.strFilenameInZip.empty())
|
if (!g_aFloppyDrive[iDrive].disk.strFilenameInZip.empty())
|
||||||
return g_aFloppyDrive[iDrive].disk.strFilenameInZip.c_str();
|
return g_aFloppyDrive[iDrive].disk.strFilenameInZip.c_str();
|
||||||
@ -537,20 +534,20 @@ LPCTSTR DiskGetFullDiskFilename(const int iDrive)
|
|||||||
return DiskGetFullName(iDrive);
|
return DiskGetFullName(iDrive);
|
||||||
}
|
}
|
||||||
|
|
||||||
static LPCTSTR DiskGetFullPathName(const int iDrive)
|
LPCTSTR DiskIIInterfaceCard::DiskGetFullPathName(const int iDrive)
|
||||||
{
|
{
|
||||||
return ImageGetPathname(g_aFloppyDrive[iDrive].disk.imagehandle);
|
return ImageGetPathname(g_aFloppyDrive[iDrive].disk.imagehandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the imagename
|
// Return the imagename
|
||||||
// . Used by Drive Button's icons & Property Sheet Page (Save snapshot)
|
// . Used by Drive Button's icons & Property Sheet Page (Save snapshot)
|
||||||
LPCTSTR DiskGetBaseName(const int iDrive)
|
LPCTSTR DiskIIInterfaceCard::DiskGetBaseName(const int iDrive)
|
||||||
{
|
{
|
||||||
return g_aFloppyDrive[iDrive].disk.imagename;
|
return g_aFloppyDrive[iDrive].disk.imagename;
|
||||||
}
|
}
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void DiskGetLightStatus(Disk_Status_e *pDisk1Status, Disk_Status_e *pDisk2Status)
|
void DiskIIInterfaceCard::DiskGetLightStatus(Disk_Status_e *pDisk1Status, Disk_Status_e *pDisk2Status)
|
||||||
{
|
{
|
||||||
if (pDisk1Status)
|
if (pDisk1Status)
|
||||||
*pDisk1Status = GetDriveLightStatus(DRIVE_1);
|
*pDisk1Status = GetDriveLightStatus(DRIVE_1);
|
||||||
@ -561,7 +558,7 @@ void DiskGetLightStatus(Disk_Status_e *pDisk1Status, Disk_Status_e *pDisk2Status
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void DiskInitialize(void)
|
void DiskIIInterfaceCard::DiskInitialize(void)
|
||||||
{
|
{
|
||||||
int loop = NUM_DRIVES;
|
int loop = NUM_DRIVES;
|
||||||
while (loop--)
|
while (loop--)
|
||||||
@ -570,7 +567,7 @@ void DiskInitialize(void)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
ImageError_e DiskInsert(const int iDrive, LPCTSTR pszImageFilename, const bool bForceWriteProtected, const bool bCreateIfNecessary)
|
ImageError_e DiskIIInterfaceCard::DiskInsert(const int iDrive, LPCTSTR pszImageFilename, const bool bForceWriteProtected, const bool bCreateIfNecessary)
|
||||||
{
|
{
|
||||||
Drive_t* pDrive = &g_aFloppyDrive[iDrive];
|
Drive_t* pDrive = &g_aFloppyDrive[iDrive];
|
||||||
Disk_t* pFloppy = &pDrive->disk;
|
Disk_t* pFloppy = &pDrive->disk;
|
||||||
@ -646,19 +643,19 @@ ImageError_e DiskInsert(const int iDrive, LPCTSTR pszImageFilename, const bool b
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
bool Disk_IsConditionForFullSpeed(void)
|
bool DiskIIInterfaceCard::Disk_IsConditionForFullSpeed(void)
|
||||||
{
|
{
|
||||||
return floppymotoron && enhancedisk;
|
return floppymotoron && enhancedisk;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL DiskIsSpinning(void)
|
BOOL DiskIIInterfaceCard::DiskIsSpinning(void)
|
||||||
{
|
{
|
||||||
return floppymotoron;
|
return floppymotoron;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void DiskNotifyInvalidImage(const int iDrive, LPCTSTR pszImageFilename, const ImageError_e Error)
|
void DiskIIInterfaceCard::DiskNotifyInvalidImage(const int iDrive, LPCTSTR pszImageFilename, const ImageError_e Error)
|
||||||
{
|
{
|
||||||
TCHAR szBuffer[MAX_PATH+128];
|
TCHAR szBuffer[MAX_PATH+128];
|
||||||
szBuffer[sizeof(szBuffer)-1] = 0;
|
szBuffer[sizeof(szBuffer)-1] = 0;
|
||||||
@ -772,7 +769,7 @@ void DiskNotifyInvalidImage(const int iDrive, LPCTSTR pszImageFilename, const Im
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
bool DiskGetProtect(const int iDrive)
|
bool DiskIIInterfaceCard::DiskGetProtect(const int iDrive)
|
||||||
{
|
{
|
||||||
if (IsDriveValid(iDrive))
|
if (IsDriveValid(iDrive))
|
||||||
{
|
{
|
||||||
@ -786,7 +783,7 @@ bool DiskGetProtect(const int iDrive)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void DiskSetProtect(const int iDrive, const bool bWriteProtect)
|
void DiskIIInterfaceCard::DiskSetProtect(const int iDrive, const bool bWriteProtect)
|
||||||
{
|
{
|
||||||
if (IsDriveValid( iDrive ))
|
if (IsDriveValid( iDrive ))
|
||||||
{
|
{
|
||||||
@ -797,7 +794,7 @@ void DiskSetProtect(const int iDrive, const bool bWriteProtect)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
bool Disk_ImageIsWriteProtected(const int iDrive)
|
bool DiskIIInterfaceCard::Disk_ImageIsWriteProtected(const int iDrive)
|
||||||
{
|
{
|
||||||
if (!IsDriveValid(iDrive))
|
if (!IsDriveValid(iDrive))
|
||||||
return true;
|
return true;
|
||||||
@ -807,7 +804,7 @@ bool Disk_ImageIsWriteProtected(const int iDrive)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
bool Disk_IsDriveEmpty(const int iDrive)
|
bool DiskIIInterfaceCard::Disk_IsDriveEmpty(const int iDrive)
|
||||||
{
|
{
|
||||||
if (!IsDriveValid(iDrive))
|
if (!IsDriveValid(iDrive))
|
||||||
return true;
|
return true;
|
||||||
@ -821,7 +818,7 @@ bool Disk_IsDriveEmpty(const int iDrive)
|
|||||||
static UINT64 g_uWriteLastCycle = 0;
|
static UINT64 g_uWriteLastCycle = 0;
|
||||||
static UINT g_uSyncFFCount = 0;
|
static UINT g_uSyncFFCount = 0;
|
||||||
|
|
||||||
static bool LogWriteCheckSyncFF(ULONG& uCycleDelta)
|
bool DiskIIInterfaceCard::LogWriteCheckSyncFF(ULONG& uCycleDelta)
|
||||||
{
|
{
|
||||||
bool bIsSyncFF = false;
|
bool bIsSyncFF = false;
|
||||||
|
|
||||||
@ -851,7 +848,7 @@ static bool LogWriteCheckSyncFF(ULONG& uCycleDelta)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static void __stdcall DiskReadWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles)
|
void __stdcall DiskIIInterfaceCard::DiskReadWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles)
|
||||||
{
|
{
|
||||||
/* floppyloadmode = 0; */
|
/* floppyloadmode = 0; */
|
||||||
Drive_t* pDrive = &g_aFloppyDrive[currdrive];
|
Drive_t* pDrive = &g_aFloppyDrive[currdrive];
|
||||||
@ -965,7 +962,7 @@ static void __stdcall DiskReadWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULO
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void DiskReset(const bool bIsPowerCycle/*=false*/)
|
void DiskIIInterfaceCard::DiskReset(const bool bIsPowerCycle/*=false*/)
|
||||||
{
|
{
|
||||||
// RESET forces all switches off (UTAIIe Table 9.1)
|
// RESET forces all switches off (UTAIIe Table 9.1)
|
||||||
currdrive = 0;
|
currdrive = 0;
|
||||||
@ -993,7 +990,7 @@ void DiskReset(const bool bIsPowerCycle/*=false*/)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static bool DiskSelectImage(const int iDrive, LPCSTR pszFilename)
|
bool DiskIIInterfaceCard::DiskSelectImage(const int iDrive, LPCSTR pszFilename)
|
||||||
{
|
{
|
||||||
TCHAR directory[MAX_PATH] = TEXT("");
|
TCHAR directory[MAX_PATH] = TEXT("");
|
||||||
TCHAR filename[MAX_PATH] = TEXT("");
|
TCHAR filename[MAX_PATH] = TEXT("");
|
||||||
@ -1044,14 +1041,14 @@ static bool DiskSelectImage(const int iDrive, LPCSTR pszFilename)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
bool DiskSelect(const int iDrive)
|
bool DiskIIInterfaceCard::DiskSelect(const int iDrive)
|
||||||
{
|
{
|
||||||
return DiskSelectImage(iDrive, TEXT(""));
|
return DiskSelectImage(iDrive, TEXT(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static void __stdcall DiskLoadWriteProtect(WORD, WORD, BYTE write, BYTE value, ULONG)
|
void __stdcall DiskIIInterfaceCard::DiskLoadWriteProtect(WORD, WORD, BYTE write, BYTE value, ULONG)
|
||||||
{
|
{
|
||||||
/* floppyloadmode = 1; */
|
/* floppyloadmode = 1; */
|
||||||
|
|
||||||
@ -1077,7 +1074,7 @@ static void __stdcall DiskLoadWriteProtect(WORD, WORD, BYTE write, BYTE value, U
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static void __stdcall DiskSetReadMode(WORD, WORD, BYTE, BYTE, ULONG)
|
void __stdcall DiskIIInterfaceCard::DiskSetReadMode(WORD, WORD, BYTE, BYTE, ULONG)
|
||||||
{
|
{
|
||||||
floppywritemode = 0;
|
floppywritemode = 0;
|
||||||
|
|
||||||
@ -1090,7 +1087,7 @@ static void __stdcall DiskSetReadMode(WORD, WORD, BYTE, BYTE, ULONG)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static void __stdcall DiskSetWriteMode(WORD, WORD, BYTE, BYTE, ULONG uExecutedCycles)
|
void __stdcall DiskIIInterfaceCard::DiskSetWriteMode(WORD, WORD, BYTE, BYTE, ULONG uExecutedCycles)
|
||||||
{
|
{
|
||||||
floppywritemode = 1;
|
floppywritemode = 1;
|
||||||
|
|
||||||
@ -1112,7 +1109,7 @@ static void __stdcall DiskSetWriteMode(WORD, WORD, BYTE, BYTE, ULONG uExecutedCy
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void DiskUpdateDriveState(DWORD cycles)
|
void DiskIIInterfaceCard::DiskUpdateDriveState(DWORD cycles)
|
||||||
{
|
{
|
||||||
int loop = NUM_DRIVES;
|
int loop = NUM_DRIVES;
|
||||||
while (loop--)
|
while (loop--)
|
||||||
@ -1145,7 +1142,7 @@ void DiskUpdateDriveState(DWORD cycles)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
bool DiskDriveSwap(void)
|
bool DiskIIInterfaceCard::DiskDriveSwap(void)
|
||||||
{
|
{
|
||||||
// Refuse to swap if either Disk][ is active
|
// Refuse to swap if either Disk][ is active
|
||||||
// TODO: if Shift-Click then FORCE drive swap to bypass message
|
// TODO: if Shift-Click then FORCE drive swap to bypass message
|
||||||
@ -1200,11 +1197,8 @@ bool DiskDriveSwap(void)
|
|||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static BYTE __stdcall Disk_IORead(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
|
|
||||||
static BYTE __stdcall Disk_IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
|
|
||||||
|
|
||||||
// TODO: LoadRom_Disk_Floppy()
|
// TODO: LoadRom_Disk_Floppy()
|
||||||
void DiskLoadRom(LPBYTE pCxRomPeripheral, UINT uSlot)
|
void DiskIIInterfaceCard::Initialize(LPBYTE pCxRomPeripheral, UINT uSlot)
|
||||||
{
|
{
|
||||||
const UINT DISK2_FW_SIZE = APPLE_SLOT_SIZE;
|
const UINT DISK2_FW_SIZE = APPLE_SLOT_SIZE;
|
||||||
|
|
||||||
@ -1233,33 +1227,36 @@ void DiskLoadRom(LPBYTE pCxRomPeripheral, UINT uSlot)
|
|||||||
// . Patching the firmware breaks the ADC checksum used by "The CIA Files" (Tricky Dick)
|
// . 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)
|
// . In this case we can patch to compensate for an ADC or EOR checksum but not both (nickw)
|
||||||
|
|
||||||
RegisterIoHandler(uSlot, Disk_IORead, Disk_IOWrite, NULL, NULL, NULL, NULL);
|
RegisterIoHandler(uSlot, &DiskIIInterfaceCard::Disk_IORead, &DiskIIInterfaceCard::Disk_IOWrite, NULL, NULL, this, NULL);
|
||||||
|
|
||||||
g_uSlot = uSlot;
|
g_uSlot = uSlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
static BYTE __stdcall Disk_IORead(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles)
|
BYTE __stdcall DiskIIInterfaceCard::Disk_IORead(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles)
|
||||||
{
|
{
|
||||||
|
UINT uSlot = ((addr & 0xff) >> 4) - 8;
|
||||||
|
DiskIIInterfaceCard* pCard = (DiskIIInterfaceCard*) MemGetSlotParameters(uSlot);
|
||||||
|
|
||||||
switch (addr & 0xF)
|
switch (addr & 0xF)
|
||||||
{
|
{
|
||||||
case 0x0: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x0: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x1: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x1: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x2: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x2: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x3: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x3: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x4: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x4: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x5: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x5: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x6: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x6: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x7: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x7: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x8: DiskControlMotor(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x8: pCard->DiskControlMotor(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x9: DiskControlMotor(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x9: pCard->DiskControlMotor(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xA: DiskEnable(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xA: pCard->DiskEnable(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xB: DiskEnable(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xB: pCard->DiskEnable(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xC: DiskReadWrite(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xC: pCard->DiskReadWrite(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xD: DiskLoadWriteProtect(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xD: pCard->DiskLoadWriteProtect(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xE: DiskSetReadMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xE: pCard->DiskSetReadMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xF: DiskSetWriteMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xF: pCard->DiskSetWriteMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only even addresses return the latch (UTAIIe Table 9.1)
|
// only even addresses return the latch (UTAIIe Table 9.1)
|
||||||
@ -1269,26 +1266,29 @@ static BYTE __stdcall Disk_IORead(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
|
|||||||
return MemReadFloatingBus(nExecutedCycles);
|
return MemReadFloatingBus(nExecutedCycles);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BYTE __stdcall Disk_IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles)
|
BYTE __stdcall DiskIIInterfaceCard::Disk_IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles)
|
||||||
{
|
{
|
||||||
|
UINT uSlot = ((addr & 0xff) >> 4) - 8;
|
||||||
|
DiskIIInterfaceCard* pCard = (DiskIIInterfaceCard*) MemGetSlotParameters(uSlot);
|
||||||
|
|
||||||
switch (addr & 0xF)
|
switch (addr & 0xF)
|
||||||
{
|
{
|
||||||
case 0x0: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x0: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x1: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x1: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x2: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x2: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x3: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x3: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x4: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x4: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x5: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x5: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x6: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x6: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x7: DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x7: pCard->DiskControlStepper(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x8: DiskControlMotor(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x8: pCard->DiskControlMotor(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0x9: DiskControlMotor(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0x9: pCard->DiskControlMotor(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xA: DiskEnable(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xA: pCard->DiskEnable(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xB: DiskEnable(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xB: pCard->DiskEnable(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xC: DiskReadWrite(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xC: pCard->DiskReadWrite(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xD: DiskLoadWriteProtect(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xD: pCard->DiskLoadWriteProtect(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xE: DiskSetReadMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xE: pCard->DiskSetReadMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
case 0xF: DiskSetWriteMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
case 0xF: pCard->DiskSetWriteMode(pc, addr, bWrite, d, nExecutedCycles); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// any address writes the latch via sequencer LD command (74LS323 datasheet)
|
// any address writes the latch via sequencer LD command (74LS323 datasheet)
|
||||||
@ -1331,13 +1331,13 @@ static const UINT kUNIT_VERSION = 3;
|
|||||||
#define SS_YAML_KEY_TRACK_IMAGE_DIRTY "Track Image Dirty"
|
#define SS_YAML_KEY_TRACK_IMAGE_DIRTY "Track Image Dirty"
|
||||||
#define SS_YAML_KEY_TRACK_IMAGE "Track Image"
|
#define SS_YAML_KEY_TRACK_IMAGE "Track Image"
|
||||||
|
|
||||||
std::string DiskGetSnapshotCardName(void)
|
std::string DiskIIInterfaceCard::DiskGetSnapshotCardName(void)
|
||||||
{
|
{
|
||||||
static const std::string name(SS_YAML_VALUE_CARD_DISK2);
|
static const std::string name(SS_YAML_VALUE_CARD_DISK2);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DiskSaveSnapshotDisk2Unit(YamlSaveHelper& yamlSaveHelper, UINT unit)
|
void DiskIIInterfaceCard::DiskSaveSnapshotDisk2Unit(YamlSaveHelper& yamlSaveHelper, UINT unit)
|
||||||
{
|
{
|
||||||
YamlSaveHelper::Label label(yamlSaveHelper, "%s%d:\n", SS_YAML_KEY_DISK2UNIT, unit);
|
YamlSaveHelper::Label label(yamlSaveHelper, "%s%d:\n", SS_YAML_KEY_DISK2UNIT, unit);
|
||||||
yamlSaveHelper.SaveString(SS_YAML_KEY_FILENAME, g_aFloppyDrive[unit].disk.fullname);
|
yamlSaveHelper.SaveString(SS_YAML_KEY_FILENAME, g_aFloppyDrive[unit].disk.fullname);
|
||||||
@ -1358,7 +1358,7 @@ static void DiskSaveSnapshotDisk2Unit(YamlSaveHelper& yamlSaveHelper, UINT unit)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiskSaveSnapshot(class YamlSaveHelper& yamlSaveHelper)
|
void DiskIIInterfaceCard::DiskSaveSnapshot(class YamlSaveHelper& yamlSaveHelper)
|
||||||
{
|
{
|
||||||
YamlSaveHelper::Slot slot(yamlSaveHelper, DiskGetSnapshotCardName(), g_uSlot, kUNIT_VERSION);
|
YamlSaveHelper::Slot slot(yamlSaveHelper, DiskGetSnapshotCardName(), g_uSlot, kUNIT_VERSION);
|
||||||
|
|
||||||
@ -1378,7 +1378,7 @@ void DiskSaveSnapshot(class YamlSaveHelper& yamlSaveHelper)
|
|||||||
DiskSaveSnapshotDisk2Unit(yamlSaveHelper, DRIVE_2);
|
DiskSaveSnapshotDisk2Unit(yamlSaveHelper, DRIVE_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DiskLoadSnapshotDriveUnit(YamlLoadHelper& yamlLoadHelper, UINT unit)
|
void DiskIIInterfaceCard::DiskLoadSnapshotDriveUnit(YamlLoadHelper& yamlLoadHelper, UINT unit)
|
||||||
{
|
{
|
||||||
std::string disk2UnitName = std::string(SS_YAML_KEY_DISK2UNIT) + (unit == DRIVE_1 ? std::string("0") : std::string("1"));
|
std::string disk2UnitName = std::string(SS_YAML_KEY_DISK2UNIT) + (unit == DRIVE_1 ? std::string("0") : std::string("1"));
|
||||||
if (!yamlLoadHelper.GetSubMap(disk2UnitName))
|
if (!yamlLoadHelper.GetSubMap(disk2UnitName))
|
||||||
@ -1455,7 +1455,7 @@ static void DiskLoadSnapshotDriveUnit(YamlLoadHelper& yamlLoadHelper, UINT unit)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DiskLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version)
|
bool DiskIIInterfaceCard::DiskLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version)
|
||||||
{
|
{
|
||||||
if (slot != 6) // fixme
|
if (slot != 6) // fixme
|
||||||
throw std::string("Card: wrong slot");
|
throw std::string("Card: wrong slot");
|
||||||
|
108
source/Disk.h
108
source/Disk.h
@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
|
|
||||||
#include "DiskImage.h"
|
#include "DiskImage.h"
|
||||||
|
|
||||||
|
extern class DiskIIInterfaceCard sg_DiskIICard;
|
||||||
|
|
||||||
// Floppy Disk Drives
|
// Floppy Disk Drives
|
||||||
|
|
||||||
enum Drive_e
|
enum Drive_e
|
||||||
@ -39,51 +41,85 @@ const bool IMAGE_FORCE_WRITE_PROTECTED = true;
|
|||||||
const bool IMAGE_DONT_CREATE = false;
|
const bool IMAGE_DONT_CREATE = false;
|
||||||
const bool IMAGE_CREATE = true;
|
const bool IMAGE_CREATE = true;
|
||||||
|
|
||||||
const char* DiskGetDiskPathFilename(const int iDrive);
|
class DiskIIInterfaceCard
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DiskIIInterfaceCard(void){};
|
||||||
|
virtual ~DiskIIInterfaceCard(void){};
|
||||||
|
|
||||||
void DiskInitialize(void); // DiskIIManagerStartup()
|
const char* DiskGetDiskPathFilename(const int iDrive);
|
||||||
void DiskDestroy(void); // no, doesn't "destroy" the disk image. DiskIIManagerShutdown()
|
|
||||||
|
|
||||||
void DiskBoot(void);
|
void DiskInitialize(void); // DiskIIManagerStartup()
|
||||||
void DiskEject(const int iDrive);
|
void DiskDestroy(void); // no, doesn't "destroy" the disk image. DiskIIManagerShutdown()
|
||||||
void DiskFlushCurrentTrack(const int iDrive);
|
|
||||||
|
|
||||||
LPCTSTR DiskGetFullName(const int iDrive);
|
void DiskBoot(void);
|
||||||
LPCTSTR DiskGetFullDiskFilename(const int iDrive);
|
void DiskEject(const int iDrive);
|
||||||
LPCTSTR DiskGetBaseName(const int iDrive);
|
void DiskFlushCurrentTrack(const int iDrive);
|
||||||
|
|
||||||
void DiskGetLightStatus (Disk_Status_e* pDisk1Status, Disk_Status_e* pDisk2Status);
|
LPCTSTR DiskGetFullName(const int iDrive);
|
||||||
|
LPCTSTR DiskGetFullDiskFilename(const int iDrive);
|
||||||
|
LPCTSTR DiskGetBaseName(const int iDrive);
|
||||||
|
|
||||||
ImageError_e DiskInsert(const int iDrive, LPCTSTR pszImageFilename, const bool bForceWriteProtected, const bool bCreateIfNecessary);
|
void DiskGetLightStatus (Disk_Status_e* pDisk1Status, Disk_Status_e* pDisk2Status);
|
||||||
bool Disk_IsConditionForFullSpeed(void);
|
|
||||||
BOOL DiskIsSpinning(void);
|
|
||||||
void DiskNotifyInvalidImage(const int iDrive, LPCTSTR pszImageFilename, const ImageError_e Error);
|
|
||||||
void DiskReset(const bool bIsPowerCycle=false);
|
|
||||||
bool DiskGetProtect(const int iDrive);
|
|
||||||
void DiskSetProtect(const int iDrive, const bool bWriteProtect);
|
|
||||||
int DiskGetCurrentDrive();
|
|
||||||
int DiskGetCurrentTrack();
|
|
||||||
int DiskGetTrack( int drive );
|
|
||||||
int DiskGetCurrentPhase();
|
|
||||||
int DiskGetCurrentOffset();
|
|
||||||
const char* DiskGetCurrentState();
|
|
||||||
bool DiskSelect(const int iDrive);
|
|
||||||
void DiskUpdateDriveState(DWORD);
|
|
||||||
bool DiskDriveSwap(void);
|
|
||||||
void DiskLoadRom(LPBYTE pCxRomPeripheral, UINT uSlot);
|
|
||||||
|
|
||||||
std::string DiskGetSnapshotCardName(void);
|
ImageError_e DiskInsert(const int iDrive, LPCTSTR pszImageFilename, const bool bForceWriteProtected, const bool bCreateIfNecessary);
|
||||||
void DiskSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
bool Disk_IsConditionForFullSpeed(void);
|
||||||
bool DiskLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
BOOL DiskIsSpinning(void);
|
||||||
|
void DiskNotifyInvalidImage(const int iDrive, LPCTSTR pszImageFilename, const ImageError_e Error);
|
||||||
|
void DiskReset(const bool bIsPowerCycle=false);
|
||||||
|
bool DiskGetProtect(const int iDrive);
|
||||||
|
void DiskSetProtect(const int iDrive, const bool bWriteProtect);
|
||||||
|
int DiskGetCurrentDrive();
|
||||||
|
int DiskGetCurrentTrack();
|
||||||
|
int DiskGetTrack( int drive );
|
||||||
|
int DiskGetCurrentPhase();
|
||||||
|
int DiskGetCurrentOffset();
|
||||||
|
const char* DiskGetCurrentState();
|
||||||
|
bool DiskSelect(const int iDrive);
|
||||||
|
void DiskUpdateDriveState(DWORD);
|
||||||
|
bool DiskDriveSwap(void);
|
||||||
|
void Initialize(LPBYTE pCxRomPeripheral, UINT uSlot);
|
||||||
|
|
||||||
void Disk_LoadLastDiskImage(const int iDrive);
|
std::string DiskGetSnapshotCardName(void);
|
||||||
void Disk_SaveLastDiskImage(const int iDrive);
|
void DiskSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
||||||
|
bool DiskLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
|
||||||
|
|
||||||
bool Disk_ImageIsWriteProtected(const int iDrive);
|
void Disk_LoadLastDiskImage(const int iDrive);
|
||||||
bool Disk_IsDriveEmpty(const int iDrive);
|
void Disk_SaveLastDiskImage(const int iDrive);
|
||||||
|
|
||||||
bool Disk_GetEnhanceDisk(void);
|
bool Disk_ImageIsWriteProtected(const int iDrive);
|
||||||
void Disk_SetEnhanceDisk(bool bEnhanceDisk);
|
bool Disk_IsDriveEmpty(const int iDrive);
|
||||||
|
|
||||||
|
bool Disk_GetEnhanceDisk(void);
|
||||||
|
void Disk_SetEnhanceDisk(bool bEnhanceDisk);
|
||||||
|
|
||||||
|
static BYTE __stdcall DiskIIInterfaceCard::Disk_IORead(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
|
||||||
|
static BYTE __stdcall DiskIIInterfaceCard::Disk_IOWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void DiskIIInterfaceCard::CheckSpinning(const ULONG nExecutedCycles);
|
||||||
|
Disk_Status_e DiskIIInterfaceCard::GetDriveLightStatus(const int iDrive);
|
||||||
|
bool DiskIIInterfaceCard::IsDriveValid(const int iDrive);
|
||||||
|
void DiskIIInterfaceCard::AllocTrack(const int iDrive);
|
||||||
|
void DiskIIInterfaceCard::ReadTrack(const int iDrive);
|
||||||
|
void DiskIIInterfaceCard::RemoveDisk(const int iDrive);
|
||||||
|
void DiskIIInterfaceCard::WriteTrack(const int iDrive);
|
||||||
|
LPCTSTR DiskIIInterfaceCard::DiskGetFullPathName(const int iDrive);
|
||||||
|
bool DiskIIInterfaceCard::DiskSelectImage(const int iDrive, LPCSTR pszFilename);
|
||||||
|
void DiskIIInterfaceCard::DiskSaveSnapshotDisk2Unit(YamlSaveHelper& yamlSaveHelper, UINT unit);
|
||||||
|
void DiskIIInterfaceCard::DiskLoadSnapshotDriveUnit(YamlLoadHelper& yamlLoadHelper, UINT unit);
|
||||||
|
|
||||||
|
void __stdcall DiskIIInterfaceCard::DiskControlStepper(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles);
|
||||||
|
void __stdcall DiskIIInterfaceCard::DiskControlMotor(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles);
|
||||||
|
void __stdcall DiskIIInterfaceCard::DiskEnable(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles);
|
||||||
|
void __stdcall DiskIIInterfaceCard::DiskReadWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
|
||||||
|
void __stdcall DiskIIInterfaceCard::DiskLoadWriteProtect(WORD, WORD, BYTE write, BYTE value, ULONG);
|
||||||
|
void __stdcall DiskIIInterfaceCard::DiskSetReadMode(WORD, WORD, BYTE, BYTE, ULONG);
|
||||||
|
void __stdcall DiskIIInterfaceCard::DiskSetWriteMode(WORD, WORD, BYTE, BYTE, ULONG uExecutedCycles);
|
||||||
|
|
||||||
|
//#if LOG_DISK_NIBBLES_WRITE
|
||||||
|
bool DiskIIInterfaceCard::LogWriteCheckSyncFF(ULONG& uCycleDelta);
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -155,7 +155,8 @@ void ImageReadTrack( ImageInfo* const pImageInfo,
|
|||||||
const int nTrack,
|
const int nTrack,
|
||||||
const int nQuarterTrack,
|
const int nQuarterTrack,
|
||||||
LPBYTE pTrackImageBuffer,
|
LPBYTE pTrackImageBuffer,
|
||||||
int* pNibbles)
|
int* pNibbles,
|
||||||
|
bool enhancedisk)
|
||||||
{
|
{
|
||||||
_ASSERT(nTrack >= 0);
|
_ASSERT(nTrack >= 0);
|
||||||
if (nTrack < 0)
|
if (nTrack < 0)
|
||||||
@ -163,7 +164,7 @@ void ImageReadTrack( ImageInfo* const pImageInfo,
|
|||||||
|
|
||||||
if (pImageInfo->pImageType->AllowRW() && pImageInfo->ValidTrack[nTrack])
|
if (pImageInfo->pImageType->AllowRW() && pImageInfo->ValidTrack[nTrack])
|
||||||
{
|
{
|
||||||
pImageInfo->pImageType->Read(pImageInfo, nTrack, nQuarterTrack, pTrackImageBuffer, pNibbles);
|
pImageInfo->pImageType->Read(pImageInfo, nTrack, nQuarterTrack, pTrackImageBuffer, pNibbles, enhancedisk);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -71,7 +71,7 @@ BOOL ImageBoot(ImageInfo* const pImageInfo);
|
|||||||
void ImageDestroy(void);
|
void ImageDestroy(void);
|
||||||
void ImageInitialize(void);
|
void ImageInitialize(void);
|
||||||
|
|
||||||
void ImageReadTrack(ImageInfo* const pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles);
|
void ImageReadTrack(ImageInfo* const pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles, bool enhancedisk);
|
||||||
void ImageWriteTrack(ImageInfo* const pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImage, int nNibbles);
|
void ImageWriteTrack(ImageInfo* const pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImage, int nNibbles);
|
||||||
bool ImageReadBlock(ImageInfo* const pImageInfo, UINT nBlock, LPBYTE pBlockBuffer);
|
bool ImageReadBlock(ImageInfo* const pImageInfo, UINT nBlock, LPBYTE pBlockBuffer);
|
||||||
bool ImageWriteBlock(ImageInfo* const pImageInfo, UINT nBlock, LPBYTE pBlockBuffer);
|
bool ImageWriteBlock(ImageInfo* const pImageInfo, UINT nBlock, LPBYTE pBlockBuffer);
|
||||||
|
@ -34,7 +34,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "unzip.h"
|
#include "unzip.h"
|
||||||
|
|
||||||
#include "CPU.h"
|
#include "CPU.h"
|
||||||
#include "Disk.h"
|
|
||||||
#include "DiskImage.h"
|
#include "DiskImage.h"
|
||||||
#include "DiskImageHelper.h"
|
#include "DiskImageHelper.h"
|
||||||
#include "Memory.h"
|
#include "Memory.h"
|
||||||
@ -631,11 +630,11 @@ public:
|
|||||||
return ePossibleMatch;
|
return ePossibleMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Read(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles)
|
virtual void Read(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles, bool enhancedisk)
|
||||||
{
|
{
|
||||||
ReadTrack(pImageInfo, nTrack, ms_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
|
ReadTrack(pImageInfo, nTrack, ms_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
|
||||||
*pNibbles = NibblizeTrack(pTrackImageBuffer, eDOSOrder, nTrack);
|
*pNibbles = NibblizeTrack(pTrackImageBuffer, eDOSOrder, nTrack);
|
||||||
if (!Disk_GetEnhanceDisk())
|
if (!enhancedisk)
|
||||||
SkewTrack(nTrack, *pNibbles, pTrackImageBuffer);
|
SkewTrack(nTrack, *pNibbles, pTrackImageBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -697,11 +696,11 @@ public:
|
|||||||
return ePossibleMatch;
|
return ePossibleMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Read(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles)
|
virtual void Read(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles, bool enhancedisk)
|
||||||
{
|
{
|
||||||
ReadTrack(pImageInfo, nTrack, ms_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
|
ReadTrack(pImageInfo, nTrack, ms_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
|
||||||
*pNibbles = NibblizeTrack(pTrackImageBuffer, eProDOSOrder, nTrack);
|
*pNibbles = NibblizeTrack(pTrackImageBuffer, eProDOSOrder, nTrack);
|
||||||
if (!Disk_GetEnhanceDisk())
|
if (!enhancedisk)
|
||||||
SkewTrack(nTrack, *pNibbles, pTrackImageBuffer);
|
SkewTrack(nTrack, *pNibbles, pTrackImageBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -736,7 +735,7 @@ public:
|
|||||||
return eMatch;
|
return eMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Read(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles)
|
virtual void Read(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles, bool enhancedisk)
|
||||||
{
|
{
|
||||||
ReadTrack(pImageInfo, nTrack, pTrackImageBuffer, NIB1_TRACK_SIZE);
|
ReadTrack(pImageInfo, nTrack, pTrackImageBuffer, NIB1_TRACK_SIZE);
|
||||||
*pNibbles = NIB1_TRACK_SIZE;
|
*pNibbles = NIB1_TRACK_SIZE;
|
||||||
@ -776,7 +775,7 @@ public:
|
|||||||
return eMatch;
|
return eMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Read(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles)
|
virtual void Read(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles, bool enhancedisk)
|
||||||
{
|
{
|
||||||
ReadTrack(pImageInfo, nTrack, pTrackImageBuffer, NIB2_TRACK_SIZE);
|
ReadTrack(pImageInfo, nTrack, pTrackImageBuffer, NIB2_TRACK_SIZE);
|
||||||
*pNibbles = NIB2_TRACK_SIZE;
|
*pNibbles = NIB2_TRACK_SIZE;
|
||||||
@ -852,7 +851,7 @@ public:
|
|||||||
return eMatch;
|
return eMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Read(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles)
|
virtual void Read(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles, bool enhancedisk)
|
||||||
{
|
{
|
||||||
// IF WE HAVEN'T ALREADY DONE SO, READ THE IMAGE FILE HEADER
|
// IF WE HAVEN'T ALREADY DONE SO, READ THE IMAGE FILE HEADER
|
||||||
if (!m_pHeader)
|
if (!m_pHeader)
|
||||||
|
@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
virtual bool Boot(ImageInfo* pImageInfo) { return false; }
|
virtual bool Boot(ImageInfo* pImageInfo) { return false; }
|
||||||
virtual eDetectResult Detect(const LPBYTE pImage, const DWORD dwImageSize, const TCHAR* pszExt) = 0;
|
virtual eDetectResult Detect(const LPBYTE pImage, const DWORD dwImageSize, const TCHAR* pszExt) = 0;
|
||||||
virtual void Read(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles) { }
|
virtual void Read(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImageBuffer, int* pNibbles, bool enhancedisk) { }
|
||||||
virtual bool Read(ImageInfo* pImageInfo, UINT nBlock, LPBYTE pBlockBuffer) { return false; }
|
virtual bool Read(ImageInfo* pImageInfo, UINT nBlock, LPBYTE pBlockBuffer) { return false; }
|
||||||
virtual void Write(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImage, int nNibbles) { }
|
virtual void Write(ImageInfo* pImageInfo, int nTrack, int nQuarterTrack, LPBYTE pTrackImage, int nNibbles) { }
|
||||||
virtual bool Write(ImageInfo* pImageInfo, UINT nBlock, LPBYTE pBlockBuffer) { return false; }
|
virtual bool Write(ImageInfo* pImageInfo, UINT nBlock, LPBYTE pBlockBuffer) { return false; }
|
||||||
|
@ -512,7 +512,7 @@ static void DrawButton (HDC passdc, int number) {
|
|||||||
SetTextColor(dc,RGB(0,0,0));
|
SetTextColor(dc,RGB(0,0,0));
|
||||||
SetTextAlign(dc,TA_CENTER | TA_TOP);
|
SetTextAlign(dc,TA_CENTER | TA_TOP);
|
||||||
SetBkMode(dc,TRANSPARENT);
|
SetBkMode(dc,TRANSPARENT);
|
||||||
LPCTSTR pszBaseName = DiskGetBaseName(number-BTN_DRIVE1);
|
LPCTSTR pszBaseName = sg_DiskIICard.DiskGetBaseName(number-BTN_DRIVE1);
|
||||||
ExtTextOut(dc,x+offset+22,rect.top,ETO_CLIPPED,&rect,
|
ExtTextOut(dc,x+offset+22,rect.top,ETO_CLIPPED,&rect,
|
||||||
pszBaseName,
|
pszBaseName,
|
||||||
MIN(8,_tcslen(pszBaseName)),
|
MIN(8,_tcslen(pszBaseName)),
|
||||||
@ -702,7 +702,7 @@ void FrameDrawDiskLEDS( HDC passdc )
|
|||||||
{
|
{
|
||||||
Disk_Status_e eDrive1Status;
|
Disk_Status_e eDrive1Status;
|
||||||
Disk_Status_e eDrive2Status;
|
Disk_Status_e eDrive2Status;
|
||||||
DiskGetLightStatus(&eDrive1Status, &eDrive2Status);
|
sg_DiskIICard.DiskGetLightStatus(&eDrive1Status, &eDrive2Status);
|
||||||
|
|
||||||
g_eStatusDrive1 = eDrive1Status;
|
g_eStatusDrive1 = eDrive1Status;
|
||||||
g_eStatusDrive2 = eDrive2Status;
|
g_eStatusDrive2 = eDrive2Status;
|
||||||
@ -755,10 +755,10 @@ void FrameDrawDiskStatus( HDC passdc )
|
|||||||
// Track $B7EC LC1 $D356
|
// Track $B7EC LC1 $D356
|
||||||
// Sector $B7ED LC1 $D357
|
// Sector $B7ED LC1 $D357
|
||||||
// RWTS LC1 $D300
|
// RWTS LC1 $D300
|
||||||
int nActiveFloppy = DiskGetCurrentDrive();
|
int nActiveFloppy = sg_DiskIICard.DiskGetCurrentDrive();
|
||||||
|
|
||||||
int nDisk1Track = DiskGetTrack(0);
|
int nDisk1Track = sg_DiskIICard.DiskGetTrack(DRIVE_1);
|
||||||
int nDisk2Track = DiskGetTrack(1);
|
int nDisk2Track = sg_DiskIICard.DiskGetTrack(DRIVE_2);
|
||||||
|
|
||||||
// Probe known OS's for Track/Sector
|
// Probe known OS's for Track/Sector
|
||||||
int isProDOS = mem[ 0xBF00 ] == 0x4C;
|
int isProDOS = mem[ 0xBF00 ] == 0x4C;
|
||||||
@ -1103,7 +1103,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
Snapshot_Shutdown();
|
Snapshot_Shutdown();
|
||||||
DebugDestroy();
|
DebugDestroy();
|
||||||
if (!g_bRestart) {
|
if (!g_bRestart) {
|
||||||
DiskDestroy();
|
sg_DiskIICard.DiskDestroy();
|
||||||
ImageDestroy();
|
ImageDestroy();
|
||||||
HD_Destroy();
|
HD_Destroy();
|
||||||
}
|
}
|
||||||
@ -1161,7 +1161,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
LogFileOutput("WM_DDE_EXECUTE\n");
|
LogFileOutput("WM_DDE_EXECUTE\n");
|
||||||
LPTSTR filename = (LPTSTR)GlobalLock((HGLOBAL)lparam);
|
LPTSTR filename = (LPTSTR)GlobalLock((HGLOBAL)lparam);
|
||||||
//MessageBox( g_hFrameWindow, filename, "DDE Exec", MB_OK );
|
//MessageBox( g_hFrameWindow, filename, "DDE Exec", MB_OK );
|
||||||
ImageError_e Error = DiskInsert(DRIVE_1, filename, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
|
ImageError_e Error = sg_DiskIICard.DiskInsert(DRIVE_1, filename, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
|
||||||
if (Error == eIMAGE_ERROR_NONE)
|
if (Error == eIMAGE_ERROR_NONE)
|
||||||
{
|
{
|
||||||
if (!g_bIsFullScreen)
|
if (!g_bIsFullScreen)
|
||||||
@ -1171,7 +1171,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DiskNotifyInvalidImage(DRIVE_1, filename, Error);
|
sg_DiskIICard.DiskNotifyInvalidImage(DRIVE_1, filename, Error);
|
||||||
}
|
}
|
||||||
GlobalUnlock((HGLOBAL)lparam);
|
GlobalUnlock((HGLOBAL)lparam);
|
||||||
LogFileOutput("WM_DDE_EXECUTE (done)\n");
|
LogFileOutput("WM_DDE_EXECUTE (done)\n");
|
||||||
@ -1193,7 +1193,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
rect.top = buttony+BTN_DRIVE2*BUTTONCY+1;
|
rect.top = buttony+BTN_DRIVE2*BUTTONCY+1;
|
||||||
rect.bottom = rect.top+BUTTONCY;
|
rect.bottom = rect.top+BUTTONCY;
|
||||||
const int iDrive = PtInRect(&rect,point) ? DRIVE_2 : DRIVE_1;
|
const int iDrive = PtInRect(&rect,point) ? DRIVE_2 : DRIVE_1;
|
||||||
ImageError_e Error = DiskInsert(iDrive, filename, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
|
ImageError_e Error = sg_DiskIICard.DiskInsert(iDrive, filename, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
|
||||||
if (Error == eIMAGE_ERROR_NONE)
|
if (Error == eIMAGE_ERROR_NONE)
|
||||||
{
|
{
|
||||||
if (!g_bIsFullScreen)
|
if (!g_bIsFullScreen)
|
||||||
@ -1207,7 +1207,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DiskNotifyInvalidImage(iDrive, filename, Error);
|
sg_DiskIICard.DiskNotifyInvalidImage(iDrive, filename, Error);
|
||||||
}
|
}
|
||||||
DragFinish((HDROP)wparam);
|
DragFinish((HDROP)wparam);
|
||||||
break;
|
break;
|
||||||
@ -1653,7 +1653,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
if(((LPNMTTDISPINFO)lparam)->hdr.hwndFrom == tooltipwindow &&
|
if(((LPNMTTDISPINFO)lparam)->hdr.hwndFrom == tooltipwindow &&
|
||||||
((LPNMTTDISPINFO)lparam)->hdr.code == TTN_GETDISPINFO)
|
((LPNMTTDISPINFO)lparam)->hdr.code == TTN_GETDISPINFO)
|
||||||
((LPNMTTDISPINFO)lparam)->lpszText =
|
((LPNMTTDISPINFO)lparam)->lpszText =
|
||||||
(LPTSTR)DiskGetFullDiskFilename(((LPNMTTDISPINFO)lparam)->hdr.idFrom);
|
(LPTSTR)sg_DiskIICard.DiskGetFullDiskFilename(((LPNMTTDISPINFO)lparam)->hdr.idFrom);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
@ -1967,7 +1967,7 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
|
|||||||
|
|
||||||
if (g_nAppMode == MODE_LOGO)
|
if (g_nAppMode == MODE_LOGO)
|
||||||
{
|
{
|
||||||
DiskBoot();
|
sg_DiskIICard.DiskBoot();
|
||||||
LogFileTimeUntilFirstKeyReadReset();
|
LogFileTimeUntilFirstKeyReadReset();
|
||||||
g_nAppMode = MODE_RUNNING;
|
g_nAppMode = MODE_RUNNING;
|
||||||
}
|
}
|
||||||
@ -1990,13 +1990,13 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
|
|||||||
|
|
||||||
case BTN_DRIVE1:
|
case BTN_DRIVE1:
|
||||||
case BTN_DRIVE2:
|
case BTN_DRIVE2:
|
||||||
DiskSelect(button-BTN_DRIVE1);
|
sg_DiskIICard.DiskSelect(button-BTN_DRIVE1);
|
||||||
if (!g_bIsFullScreen)
|
if (!g_bIsFullScreen)
|
||||||
DrawButton((HDC)0,button);
|
DrawButton((HDC)0,button);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BTN_DRIVESWAP:
|
case BTN_DRIVESWAP:
|
||||||
DiskDriveSwap();
|
sg_DiskIICard.DiskDriveSwap();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BTN_FULLSCR:
|
case BTN_FULLSCR:
|
||||||
@ -2057,7 +2057,7 @@ void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
|
|||||||
//TODO: A directory is open if an empty path to CiderPress is set. This has to be fixed.
|
//TODO: A directory is open if an empty path to CiderPress is set. This has to be fixed.
|
||||||
|
|
||||||
std::string filename1= "\"";
|
std::string filename1= "\"";
|
||||||
filename1.append( DiskGetDiskPathFilename(iDrive) );
|
filename1.append( sg_DiskIICard.DiskGetDiskPathFilename(iDrive) );
|
||||||
filename1.append("\"");
|
filename1.append("\"");
|
||||||
std::string sFileNameEmpty = "\"";
|
std::string sFileNameEmpty = "\"";
|
||||||
sFileNameEmpty.append("\"");
|
sFileNameEmpty.append("\"");
|
||||||
@ -2079,16 +2079,16 @@ void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
|
|||||||
// Check menu depending on current floppy protection
|
// Check menu depending on current floppy protection
|
||||||
{
|
{
|
||||||
int iMenuItem = ID_DISKMENU_WRITEPROTECTION_OFF;
|
int iMenuItem = ID_DISKMENU_WRITEPROTECTION_OFF;
|
||||||
if (DiskGetProtect( iDrive ))
|
if (sg_DiskIICard.DiskGetProtect( iDrive ))
|
||||||
iMenuItem = ID_DISKMENU_WRITEPROTECTION_ON;
|
iMenuItem = ID_DISKMENU_WRITEPROTECTION_ON;
|
||||||
|
|
||||||
CheckMenuItem(hmenu, iMenuItem, MF_CHECKED);
|
CheckMenuItem(hmenu, iMenuItem, MF_CHECKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Disk_IsDriveEmpty(iDrive))
|
if (sg_DiskIICard.Disk_IsDriveEmpty(iDrive))
|
||||||
EnableMenuItem(hmenu, ID_DISKMENU_EJECT, MF_GRAYED);
|
EnableMenuItem(hmenu, ID_DISKMENU_EJECT, MF_GRAYED);
|
||||||
|
|
||||||
if (Disk_ImageIsWriteProtected(iDrive))
|
if (sg_DiskIICard.Disk_ImageIsWriteProtected(iDrive))
|
||||||
{
|
{
|
||||||
// If image-file is read-only (or a gzip) then disable these menu items
|
// If image-file is read-only (or a gzip) then disable these menu items
|
||||||
EnableMenuItem(hmenu, ID_DISKMENU_WRITEPROTECTION_ON, MF_GRAYED);
|
EnableMenuItem(hmenu, ID_DISKMENU_WRITEPROTECTION_ON, MF_GRAYED);
|
||||||
@ -2104,13 +2104,13 @@ void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
|
|||||||
, hwnd, NULL );
|
, hwnd, NULL );
|
||||||
|
|
||||||
if (iCommand == ID_DISKMENU_EJECT)
|
if (iCommand == ID_DISKMENU_EJECT)
|
||||||
DiskEject( iDrive );
|
sg_DiskIICard.DiskEject( iDrive );
|
||||||
else
|
else
|
||||||
if (iCommand == ID_DISKMENU_WRITEPROTECTION_ON)
|
if (iCommand == ID_DISKMENU_WRITEPROTECTION_ON)
|
||||||
DiskSetProtect( iDrive, true );
|
sg_DiskIICard.DiskSetProtect( iDrive, true );
|
||||||
else
|
else
|
||||||
if (iCommand == ID_DISKMENU_WRITEPROTECTION_OFF)
|
if (iCommand == ID_DISKMENU_WRITEPROTECTION_OFF)
|
||||||
DiskSetProtect( iDrive, false );
|
sg_DiskIICard.DiskSetProtect( iDrive, false );
|
||||||
else
|
else
|
||||||
if (iCommand == ID_DISKMENU_SENDTO_CIDERPRESS)
|
if (iCommand == ID_DISKMENU_SENDTO_CIDERPRESS)
|
||||||
{
|
{
|
||||||
@ -2119,7 +2119,7 @@ void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive)
|
|||||||
"Please install CiderPress.\n"
|
"Please install CiderPress.\n"
|
||||||
"Otherwise set the path to CiderPress from Configuration->Disk.";
|
"Otherwise set the path to CiderPress from Configuration->Disk.";
|
||||||
|
|
||||||
DiskFlushCurrentTrack(iDrive);
|
sg_DiskIICard.DiskFlushCurrentTrack(iDrive);
|
||||||
|
|
||||||
//if(!filename1.compare("\"\"") == false) //Do not use this, for some reason it does not work!!!
|
//if(!filename1.compare("\"\"") == false) //Do not use this, for some reason it does not work!!!
|
||||||
if(!filename1.compare(sFileNameEmpty) )
|
if(!filename1.compare(sFileNameEmpty) )
|
||||||
@ -2181,13 +2181,13 @@ void RelayEvent (UINT message, WPARAM wparam, LPARAM lparam) {
|
|||||||
// todo: consolidate CtrlReset() and ResetMachineState()
|
// todo: consolidate CtrlReset() and ResetMachineState()
|
||||||
void ResetMachineState ()
|
void ResetMachineState ()
|
||||||
{
|
{
|
||||||
DiskReset(true);
|
sg_DiskIICard.DiskReset(true);
|
||||||
HD_Reset();
|
HD_Reset();
|
||||||
g_bFullSpeed = 0; // Might've hit reset in middle of InternalCpuExecute() - so beep may get (partially) muted
|
g_bFullSpeed = 0; // Might've hit reset in middle of InternalCpuExecute() - so beep may get (partially) muted
|
||||||
|
|
||||||
MemReset(); // calls CpuInitialize()
|
MemReset(); // calls CpuInitialize()
|
||||||
PravetsReset();
|
PravetsReset();
|
||||||
DiskBoot();
|
sg_DiskIICard.DiskBoot();
|
||||||
VideoResetState();
|
VideoResetState();
|
||||||
sg_SSC.CommReset();
|
sg_SSC.CommReset();
|
||||||
PrintReset();
|
PrintReset();
|
||||||
@ -2225,7 +2225,7 @@ void CtrlReset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
PravetsReset();
|
PravetsReset();
|
||||||
DiskReset();
|
sg_DiskIICard.DiskReset();
|
||||||
HD_Reset();
|
HD_Reset();
|
||||||
KeybReset();
|
KeybReset();
|
||||||
sg_SSC.CommReset();
|
sg_SSC.CommReset();
|
||||||
|
@ -1692,7 +1692,7 @@ void MemInitializeIO(void)
|
|||||||
ConfigureSAM(pCxRomPeripheral, 5); // $C500 : Z80 card
|
ConfigureSAM(pCxRomPeripheral, 5); // $C500 : Z80 card
|
||||||
}
|
}
|
||||||
|
|
||||||
DiskLoadRom(pCxRomPeripheral, 6); // $C600 : Disk][ f/w
|
sg_DiskIICard.Initialize(pCxRomPeripheral, 6); // $C600 : Disk][ card
|
||||||
HD_Load_Rom(pCxRomPeripheral, 7); // $C700 : HDD f/w
|
HD_Load_Rom(pCxRomPeripheral, 7); // $C700 : HDD f/w
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -286,9 +286,9 @@ static void ParseSlots(YamlLoadHelper& yamlLoadHelper, UINT unitVersion)
|
|||||||
bRes = Phasor_LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
bRes = Phasor_LoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||||
type = CT_Phasor;
|
type = CT_Phasor;
|
||||||
}
|
}
|
||||||
else if (card == DiskGetSnapshotCardName())
|
else if (card == sg_DiskIICard.DiskGetSnapshotCardName())
|
||||||
{
|
{
|
||||||
bRes = DiskLoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
bRes = sg_DiskIICard.DiskLoadSnapshot(yamlLoadHelper, slot, cardVersion);
|
||||||
type = CT_Disk2;
|
type = CT_Disk2;
|
||||||
}
|
}
|
||||||
else if (card == HD_GetSnapshotCardName())
|
else if (card == HD_GetSnapshotCardName())
|
||||||
@ -391,7 +391,7 @@ static void Snapshot_LoadState_v2(void)
|
|||||||
|
|
||||||
MemReset();
|
MemReset();
|
||||||
PravetsReset();
|
PravetsReset();
|
||||||
DiskReset();
|
sg_DiskIICard.DiskReset();
|
||||||
HD_Reset();
|
HD_Reset();
|
||||||
KeybReset();
|
KeybReset();
|
||||||
VideoResetState();
|
VideoResetState();
|
||||||
@ -519,7 +519,7 @@ void Snapshot_SaveState(void)
|
|||||||
if (g_Slot4 == CT_Phasor)
|
if (g_Slot4 == CT_Phasor)
|
||||||
Phasor_SaveSnapshot(yamlSaveHelper, 4);
|
Phasor_SaveSnapshot(yamlSaveHelper, 4);
|
||||||
|
|
||||||
DiskSaveSnapshot(yamlSaveHelper);
|
sg_DiskIICard.DiskSaveSnapshot(yamlSaveHelper);
|
||||||
|
|
||||||
HD_SaveSnapshot(yamlSaveHelper);
|
HD_SaveSnapshot(yamlSaveHelper);
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ void VideoBenchmark () {
|
|||||||
while (cycles > 0) {
|
while (cycles > 0) {
|
||||||
DWORD executedcycles = CpuExecute(103, true);
|
DWORD executedcycles = CpuExecute(103, true);
|
||||||
cycles -= executedcycles;
|
cycles -= executedcycles;
|
||||||
DiskUpdateDriveState(executedcycles);
|
sg_DiskIICard.DiskUpdateDriveState(executedcycles);
|
||||||
JoyUpdateButtonLatch(executedcycles);
|
JoyUpdateButtonLatch(executedcycles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user