Merge branch 'master' into Refactor-Disk-cpp

This commit is contained in:
tomcw 2019-04-10 21:33:08 +01:00
commit c6d4512233
16 changed files with 555 additions and 523 deletions

View file

@ -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.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.UpdateDriveState(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.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.LoadLastDiskImage(DRIVE_1);
Disk_LoadLastDiskImage(DRIVE_2); sg_DiskIICard.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.InsertDisk(nDrive, strPathName.c_str(), IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
return Error == eIMAGE_ERROR_NONE; return Error == eIMAGE_ERROR_NONE;
} }
@ -1521,9 +1522,6 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
ImageInitialize(); ImageInitialize();
LogFileOutput("Init: ImageInitialize()\n"); LogFileOutput("Init: ImageInitialize()\n");
DiskInitialize();
LogFileOutput("Init: DiskInitialize()\n");
// //
do do
@ -1615,7 +1613,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.Reset(); // 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");

View file

@ -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.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.GetFullName(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.GetFullName(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.GetFullName(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.GetFullName(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.GetEnhanceDisk())
{ {
Disk_SetEnhanceDisk(bNewEnhanceDisk); sg_DiskIICard.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.UserSelectNewDiskImage(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.GetFullName(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.GetFullName(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.EjectDisk(driveSelected);
// Remove drive from list // Remove drive from list
SendDlgItemMessage(hWnd, comboSelected, CB_DELETESTRING, 0, 0); SendDlgItemMessage(hWnd, comboSelected, CB_DELETESTRING, 0, 0);
} }

View file

@ -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.GetBaseName(DRIVE_1);
if (pDiskName && pDiskName[0]) if (pDiskName && pDiskName[0])
{ {
strcpy(pszFilename, pDiskName); strcpy(pszFilename, pDiskName);

View file

@ -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.GetCurrentDrive() + 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.GetCurrentTrack(),
DiskGetCurrentTrack(), sg_DiskIICard.GetCurrentTrack(),
DiskGetCurrentPhase(), sg_DiskIICard.GetCurrentPhase(),
DiskGetCurrentOffset(), sg_DiskIICard.GetCurrentOffset(),
DiskGetCurrentState()); sg_DiskIICard.GetCurrentState());
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.EjectDisk( 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.SetProtect( 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.InsertDisk( iDrive, pDiskName, IMAGE_FORCE_WRITE_PROTECTED, IMAGE_DONT_CREATE );
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES); FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
} }

File diff suppressed because it is too large Load diff

View file

@ -23,8 +23,12 @@ along with AppleWin; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "DiskLog.h"
#include "DiskFormatTrack.h"
#include "DiskImage.h" #include "DiskImage.h"
extern class DiskIIInterfaceCard sg_DiskIICard;
// Floppy Disk Drives // Floppy Disk Drives
enum Drive_e enum Drive_e
@ -39,55 +43,6 @@ 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);
void DiskInitialize(void); // DiskIIManagerStartup()
void DiskDestroy(void); // no, doesn't "destroy" the disk image. DiskIIManagerShutdown()
void DiskBoot(void);
void DiskEject(const int iDrive);
void DiskFlushCurrentTrack(const int iDrive);
LPCTSTR DiskGetFullName(const int iDrive);
LPCTSTR DiskGetFullDiskFilename(const int iDrive);
LPCTSTR DiskGetBaseName(const int iDrive);
void DiskGetLightStatus (Disk_Status_e* pDisk1Status, Disk_Status_e* pDisk2Status);
ImageError_e DiskInsert(const int iDrive, LPCTSTR pszImageFilename, const bool bForceWriteProtected, const bool bCreateIfNecessary);
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);
void DiskSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
bool DiskLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
void Disk_LoadLastDiskImage(const int iDrive);
void Disk_SaveLastDiskImage(const int iDrive);
bool Disk_ImageIsWriteProtected(const int iDrive);
bool Disk_IsDriveEmpty(const int iDrive);
bool Disk_GetEnhanceDisk(void);
void Disk_SetEnhanceDisk(bool bEnhanceDisk);
//
// For sharing with class FormatTrack
struct Disk_t struct Disk_t
{ {
TCHAR imagename[ MAX_DISK_IMAGE_NAME + 1 ]; // <FILENAME> (ie. no extension) TCHAR imagename[ MAX_DISK_IMAGE_NAME + 1 ]; // <FILENAME> (ie. no extension)
@ -122,3 +77,131 @@ struct Disk_t
trackimagedirty = false; trackimagedirty = false;
} }
}; };
struct Drive_t
{
int phase;
int track;
DWORD spinning;
DWORD writelight;
Disk_t disk;
Drive_t()
{
clear();
}
void clear()
{
phase = 0;
track = 0;
spinning = 0;
writelight = 0;
disk.clear();
}
};
class DiskIIInterfaceCard
{
public:
DiskIIInterfaceCard(void);
virtual ~DiskIIInterfaceCard(void){};
void Initialize(LPBYTE pCxRomPeripheral, UINT uSlot);
void Destroy(void); // no, doesn't "destroy" the disk image. DiskIIManagerShutdown()
void Boot(void);
void FlushCurrentTrack(const int drive);
LPCTSTR GetFullDiskFilename(const int drive);
LPCTSTR GetFullName(const int drive);
LPCTSTR GetBaseName(const int drive);
void GetLightStatus (Disk_Status_e* pDisk1Status, Disk_Status_e* pDisk2Status);
ImageError_e InsertDisk(const int drive, LPCTSTR pszImageFilename, const bool bForceWriteProtected, const bool bCreateIfNecessary);
void EjectDisk(const int drive);
bool IsConditionForFullSpeed(void);
BOOL IsSpinning(void);
void NotifyInvalidImage(const int drive, LPCTSTR pszImageFilename, const ImageError_e Error);
void Reset(const bool bIsPowerCycle=false);
bool GetProtect(const int drive);
void SetProtect(const int drive, const bool bWriteProtect);
int GetCurrentDrive(void);
int GetCurrentTrack();
int GetTrack(const int drive);
int GetCurrentPhase(void);
int GetCurrentOffset(void);
LPCTSTR GetCurrentState(void);
bool UserSelectNewDiskImage(const int drive, LPCSTR pszFilename="");
void UpdateDriveState(DWORD cycles);
bool DriveSwap(void);
std::string GetSnapshotCardName(void);
void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
bool LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT slot, UINT version);
void LoadLastDiskImage(const int drive);
void SaveLastDiskImage(const int drive);
bool IsDiskImageWriteProtected(const int drive);
bool IsDriveEmpty(const int drive);
bool GetEnhanceDisk(void);
void SetEnhanceDisk(bool bEnhanceDisk);
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 CheckSpinning(const ULONG nExecutedCycles);
Disk_Status_e GetDriveLightStatus(const int drive);
bool IsDriveValid(const int drive);
void AllocTrack(const int drive);
void ReadTrack(const int drive);
void RemoveDisk(const int drive);
void WriteTrack(const int drive);
LPCTSTR DiskGetFullPathName(const int drive);
void SaveSnapshotDisk2Unit(YamlSaveHelper& yamlSaveHelper, UINT unit);
void LoadSnapshotDriveUnit(YamlLoadHelper& yamlLoadHelper, UINT unit);
void __stdcall ControlStepper(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles);
void __stdcall ControlMotor(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles);
void __stdcall Enable(WORD, WORD address, BYTE, BYTE, ULONG uExecutedCycles);
void __stdcall ReadWrite(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
void __stdcall LoadWriteProtect(WORD, WORD, BYTE write, BYTE value, ULONG);
void __stdcall SetReadMode(WORD, WORD, BYTE, BYTE, ULONG);
void __stdcall SetWriteMode(WORD, WORD, BYTE, BYTE, ULONG uExecutedCycles);
#if LOG_DISK_NIBBLES_WRITE
bool LogWriteCheckSyncFF(ULONG& uCycleDelta);
#endif
//
WORD m_currDrive;
Drive_t m_floppyDrive[NUM_DRIVES];
BYTE m_floppyLatch;
BOOL m_floppyMotorOn;
BOOL m_floppyLoadMode; // for efficiency this is not used; it's extremely unlikely to affect emulation (nickw)
BOOL m_floppyWriteMode;
WORD m_phases; // state bits for stepper magnet phases 0 - 3
bool m_saveDiskImage;
UINT m_slot;
unsigned __int64 m_diskLastCycle;
unsigned __int64 m_diskLastReadLatchCycle;
FormatTrack m_formatTrack;
bool m_enhanceDisk;
static const UINT SPINNING_CYCLES = 20000*64; // 1280000 cycles = 1.25s
static const UINT WRITELIGHT_CYCLES = 20000*64; // 1280000 cycles = 1.25s
// Debug:
#if LOG_DISK_NIBBLES_USE_RUNTIME_VAR
bool m_bLogDisk_NibblesRW; // From VS Debugger, change this to true/false during runtime for precise nibble logging
#endif
#if LOG_DISK_NIBBLES_WRITE
UINT64 m_uWriteLastCycle;
UINT m_uSyncFFCount;
#endif
};

View file

@ -45,8 +45,6 @@ Writes the following: (in 1 continuous write operation)
#include "StdAfx.h" #include "StdAfx.h"
#include "Disk.h" #include "Disk.h"
#include "DiskLog.h"
#include "DiskFormatTrack.h"
#include "Log.h" #include "Log.h"
#include "YamlHelper.h" #include "YamlHelper.h"

View file

@ -35,15 +35,15 @@ public:
void Reset(void); void Reset(void);
void DriveNotWritingTrack(void); void DriveNotWritingTrack(void);
void DriveSwitchedToReadMode(Disk_t* const pFloppy); void DriveSwitchedToReadMode(struct Disk_t* const pFloppy);
void DriveSwitchedToWriteMode(UINT uTrackIndex); void DriveSwitchedToWriteMode(UINT uTrackIndex);
void DecodeLatchNibbleRead(BYTE floppylatch); void DecodeLatchNibbleRead(BYTE floppylatch);
void DecodeLatchNibbleWrite(BYTE floppylatch, UINT uSpinNibbleCount, const Disk_t* const pFloppy, bool bIsSyncFF); void DecodeLatchNibbleWrite(BYTE floppylatch, UINT uSpinNibbleCount, const struct Disk_t* const pFloppy, bool bIsSyncFF);
void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper); void SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
void LoadSnapshot(class YamlLoadHelper& yamlLoadHelper); void LoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
private: private:
void UpdateOnWriteLatch(UINT uSpinNibbleCount, const Disk_t* const pFloppy); void UpdateOnWriteLatch(UINT uSpinNibbleCount, const struct Disk_t* const pFloppy);
void DecodeLatchNibble(BYTE floppylatch, bool bIsWrite, bool bIsSyncFF); void DecodeLatchNibble(BYTE floppylatch, bool bIsWrite, bool bIsSyncFF);
BYTE m_VolTrkSecChk[4]; BYTE m_VolTrkSecChk[4];

View file

@ -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
{ {

View file

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

View file

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

View file

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

View file

@ -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.GetBaseName(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.GetLightStatus(&eDrive1Status, &eDrive2Status);
g_eStatusDrive1 = eDrive1Status; g_eStatusDrive1 = eDrive1Status;
g_eStatusDrive2 = eDrive2Status; g_eStatusDrive2 = eDrive2Status;
@ -755,11 +755,11 @@ 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.GetCurrentDrive();
int nDisk1Track = sg_DiskIICard.GetTrack(DRIVE_1);
int nDisk2Track = sg_DiskIICard.GetTrack(DRIVE_2);
int nDisk1Track = DiskGetTrack(0);
int nDisk2Track = DiskGetTrack(1);
// Probe known OS's for Track/Sector // Probe known OS's for Track/Sector
int isProDOS = mem[ 0xBF00 ] == 0x4C; int isProDOS = mem[ 0xBF00 ] == 0x4C;
bool isValid = true; bool isValid = true;
@ -1103,7 +1103,7 @@ LRESULT CALLBACK FrameWndProc (
Snapshot_Shutdown(); Snapshot_Shutdown();
DebugDestroy(); DebugDestroy();
if (!g_bRestart) { if (!g_bRestart) {
DiskDestroy(); sg_DiskIICard.Destroy();
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.InsertDisk(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.NotifyInvalidImage(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.InsertDisk(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.NotifyInvalidImage(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.GetFullDiskFilename(((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.Boot();
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.UserSelectNewDiskImage(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.DriveSwap();
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.GetFullName(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.GetProtect( 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.IsDriveEmpty(iDrive))
EnableMenuItem(hmenu, ID_DISKMENU_EJECT, MF_GRAYED); EnableMenuItem(hmenu, ID_DISKMENU_EJECT, MF_GRAYED);
if (Disk_ImageIsWriteProtected(iDrive)) if (sg_DiskIICard.IsDiskImageWriteProtected(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.EjectDisk( iDrive );
else else
if (iCommand == ID_DISKMENU_WRITEPROTECTION_ON) if (iCommand == ID_DISKMENU_WRITEPROTECTION_ON)
DiskSetProtect( iDrive, true ); sg_DiskIICard.SetProtect( iDrive, true );
else else
if (iCommand == ID_DISKMENU_WRITEPROTECTION_OFF) if (iCommand == ID_DISKMENU_WRITEPROTECTION_OFF)
DiskSetProtect( iDrive, false ); sg_DiskIICard.SetProtect( 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.FlushCurrentTrack(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.Reset(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.Boot();
VideoResetState(); VideoResetState();
sg_SSC.CommReset(); sg_SSC.CommReset();
PrintReset(); PrintReset();
@ -2225,7 +2225,7 @@ void CtrlReset()
} }
PravetsReset(); PravetsReset();
DiskReset(); sg_DiskIICard.Reset();
HD_Reset(); HD_Reset();
KeybReset(); KeybReset();
sg_SSC.CommReset(); sg_SSC.CommReset();

View file

@ -1692,7 +1692,16 @@ void MemInitializeIO(void)
ConfigureSAM(pCxRomPeripheral, 5); // $C500 : Z80 card ConfigureSAM(pCxRomPeripheral, 5); // $C500 : Z80 card
} }
DiskLoadRom(pCxRomPeripheral, 6); // $C600 : Disk][ f/w #if 0 // debug test
if (g_Slot5 == CT_EMPTY)
{
DiskIIInterfaceCard* pDiskIISlot5 = new DiskIIInterfaceCard;
pDiskIISlot5->Initialize(pCxRomPeripheral, 5);
pDiskIISlot5->InsertDisk(0, "C:\\Work\\Personal\\Images\\lady tut PRODOS (san inc pack).dsk", false, false);
}
#endif
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
// //

View file

@ -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.GetSnapshotCardName())
{ {
bRes = DiskLoadSnapshot(yamlLoadHelper, slot, cardVersion); bRes = sg_DiskIICard.LoadSnapshot(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.Reset();
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.SaveSnapshot(yamlSaveHelper);
HD_SaveSnapshot(yamlSaveHelper); HD_SaveSnapshot(yamlSaveHelper);
} }

View file

@ -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.UpdateDriveState(executedcycles);
JoyUpdateButtonLatch(executedcycles); JoyUpdateButtonLatch(executedcycles);
} }
} }