mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-23 00:30:17 +00:00
DiskIIInterfaceCard add in private variables
This commit is contained in:
parent
e7d6eac04d
commit
bbe0e67584
@ -35,8 +35,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "Applewin.h"
|
||||
#include "CPU.h"
|
||||
#include "Disk.h"
|
||||
#include "DiskLog.h"
|
||||
#include "DiskFormatTrack.h"
|
||||
#include "DiskImage.h"
|
||||
#include "Frame.h"
|
||||
#include "Log.h"
|
||||
@ -47,58 +45,30 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#include "../resource/resource.h"
|
||||
|
||||
DiskIIInterfaceCard::DiskIIInterfaceCard(void)
|
||||
{
|
||||
currdrive = 0;
|
||||
floppylatch = 0;
|
||||
floppymotoron = 0;
|
||||
floppyloadmode = 0;
|
||||
floppywritemode = 0;
|
||||
phases = 0;
|
||||
g_bSaveDiskImage = true; // Save the DiskImage name to Registry
|
||||
g_uSlot = 0;
|
||||
g_uDiskLastCycle = 0;
|
||||
g_uDiskLastReadLatchCycle = 0;
|
||||
enhancedisk = true;
|
||||
|
||||
// Debug:
|
||||
#if LOG_DISK_NIBBLES_USE_RUNTIME_VAR
|
||||
static bool g_bLogDisk_NibblesRW = false; // From VS Debugger, change this to true/false during runtime for precise nibble logging
|
||||
g_bLogDisk_NibblesRW = false;
|
||||
#endif
|
||||
#if LOG_DISK_NIBBLES_WRITE
|
||||
g_uWriteLastCycle = 0;
|
||||
g_uSyncFFCount = 0;
|
||||
#endif
|
||||
|
||||
// Private ________________________________________________________________________________________
|
||||
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
||||
static WORD currdrive = 0;
|
||||
static Drive_t g_aFloppyDrive[NUM_DRIVES];
|
||||
static BYTE floppylatch = 0;
|
||||
static BOOL floppymotoron = 0;
|
||||
static BOOL floppyloadmode = 0; // for efficiency this is not used; it's extremely unlikely to affect emulation (nickw)
|
||||
static BOOL floppywritemode = 0;
|
||||
static WORD phases = 0; // state bits for stepper magnet phases 0 - 3
|
||||
static bool g_bSaveDiskImage = true; // Save the DiskImage name to Registry
|
||||
static UINT g_uSlot = 0;
|
||||
static unsigned __int64 g_uDiskLastCycle = 0;
|
||||
static unsigned __int64 g_uDiskLastReadLatchCycle = 0;
|
||||
static FormatTrack g_formatTrack;
|
||||
|
||||
static bool IsDriveValid( const int iDrive );
|
||||
static LPCTSTR DiskGetFullPathName(const int iDrive);
|
||||
|
||||
#define SPINNING_CYCLES (20000*64) // 1280000 cycles = 1.25s
|
||||
#define WRITELIGHT_CYCLES (20000*64) // 1280000 cycles = 1.25s
|
||||
|
||||
static bool enhancedisk = true;
|
||||
|
||||
//===========================================================================
|
||||
|
||||
bool DiskIIInterfaceCard::Disk_GetEnhanceDisk(void) { return enhancedisk; }
|
||||
void DiskIIInterfaceCard::Disk_SetEnhanceDisk(bool bEnhanceDisk) { enhancedisk = bEnhanceDisk; }
|
||||
|
||||
@ -766,7 +736,6 @@ void DiskIIInterfaceCard::DiskNotifyInvalidImage(const int iDrive, LPCTSTR pszIm
|
||||
MB_ICONEXCLAMATION | MB_SETFOREGROUND);
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
|
||||
bool DiskIIInterfaceCard::DiskGetProtect(const int iDrive)
|
||||
@ -780,7 +749,6 @@ bool DiskIIInterfaceCard::DiskGetProtect(const int iDrive)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
|
||||
void DiskIIInterfaceCard::DiskSetProtect(const int iDrive, const bool bWriteProtect)
|
||||
@ -791,7 +759,6 @@ void DiskIIInterfaceCard::DiskSetProtect(const int iDrive, const bool bWriteProt
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
|
||||
bool DiskIIInterfaceCard::Disk_ImageIsWriteProtected(const int iDrive)
|
||||
@ -815,9 +782,6 @@ bool DiskIIInterfaceCard::Disk_IsDriveEmpty(const int iDrive)
|
||||
//===========================================================================
|
||||
|
||||
#if LOG_DISK_NIBBLES_WRITE
|
||||
static UINT64 g_uWriteLastCycle = 0;
|
||||
static UINT g_uSyncFFCount = 0;
|
||||
|
||||
bool DiskIIInterfaceCard::LogWriteCheckSyncFF(ULONG& uCycleDelta)
|
||||
{
|
||||
bool bIsSyncFF = false;
|
||||
@ -1261,7 +1225,7 @@ BYTE __stdcall DiskIIInterfaceCard::Disk_IORead(WORD pc, WORD addr, BYTE bWrite,
|
||||
|
||||
// only even addresses return the latch (UTAIIe Table 9.1)
|
||||
if (!(addr & 1))
|
||||
return floppylatch;
|
||||
return pCard->floppylatch;
|
||||
else
|
||||
return MemReadFloatingBus(nExecutedCycles);
|
||||
}
|
||||
@ -1292,9 +1256,9 @@ BYTE __stdcall DiskIIInterfaceCard::Disk_IOWrite(WORD pc, WORD addr, BYTE bWrite
|
||||
}
|
||||
|
||||
// any address writes the latch via sequencer LD command (74LS323 datasheet)
|
||||
if (floppywritemode /* && floppyloadmode */)
|
||||
if (pCard->floppywritemode /* && floppyloadmode */)
|
||||
{
|
||||
floppylatch = d;
|
||||
pCard->floppylatch = d;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
131
source/Disk.h
131
source/Disk.h
@ -23,6 +23,8 @@ along with AppleWin; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "DiskLog.h"
|
||||
#include "DiskFormatTrack.h"
|
||||
#include "DiskImage.h"
|
||||
|
||||
extern class DiskIIInterfaceCard sg_DiskIICard;
|
||||
@ -41,10 +43,68 @@ const bool IMAGE_FORCE_WRITE_PROTECTED = true;
|
||||
const bool IMAGE_DONT_CREATE = false;
|
||||
const bool IMAGE_CREATE = true;
|
||||
|
||||
struct Disk_t
|
||||
{
|
||||
TCHAR imagename[ MAX_DISK_IMAGE_NAME + 1 ]; // <FILENAME> (ie. no extension)
|
||||
TCHAR fullname [ MAX_DISK_FULL_NAME + 1 ]; // <FILENAME.EXT> or <FILENAME.zip> : This is persisted to the snapshot file
|
||||
std::string strFilenameInZip; // "" or <FILENAME.EXT>
|
||||
ImageInfo* imagehandle; // Init'd by DiskInsert() -> ImageOpen()
|
||||
bool bWriteProtected;
|
||||
//
|
||||
int byte;
|
||||
int nibbles; // Init'd by ReadTrack() -> ImageReadTrack()
|
||||
LPBYTE trackimage;
|
||||
bool trackimagedata;
|
||||
bool trackimagedirty;
|
||||
|
||||
Disk_t()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
ZeroMemory(imagename, sizeof(imagename));
|
||||
ZeroMemory(fullname, sizeof(fullname));
|
||||
strFilenameInZip.clear();
|
||||
imagehandle = NULL;
|
||||
bWriteProtected = false;
|
||||
//
|
||||
byte = 0;
|
||||
nibbles = 0;
|
||||
trackimage = NULL;
|
||||
trackimagedata = 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){};
|
||||
DiskIIInterfaceCard(void);
|
||||
virtual ~DiskIIInterfaceCard(void){};
|
||||
|
||||
const char* DiskGetDiskPathFilename(const int iDrive);
|
||||
@ -117,44 +177,35 @@ private:
|
||||
void __stdcall DiskIIInterfaceCard::DiskSetReadMode(WORD, WORD, BYTE, BYTE, ULONG);
|
||||
void __stdcall DiskIIInterfaceCard::DiskSetWriteMode(WORD, WORD, BYTE, BYTE, ULONG uExecutedCycles);
|
||||
|
||||
//#if LOG_DISK_NIBBLES_WRITE
|
||||
#if LOG_DISK_NIBBLES_WRITE
|
||||
bool DiskIIInterfaceCard::LogWriteCheckSyncFF(ULONG& uCycleDelta);
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
// For sharing with class FormatTrack
|
||||
struct Disk_t
|
||||
{
|
||||
TCHAR imagename[ MAX_DISK_IMAGE_NAME + 1 ]; // <FILENAME> (ie. no extension)
|
||||
TCHAR fullname [ MAX_DISK_FULL_NAME + 1 ]; // <FILENAME.EXT> or <FILENAME.zip> : This is persisted to the snapshot file
|
||||
std::string strFilenameInZip; // "" or <FILENAME.EXT>
|
||||
ImageInfo* imagehandle; // Init'd by DiskInsert() -> ImageOpen()
|
||||
bool bWriteProtected;
|
||||
//
|
||||
int byte;
|
||||
int nibbles; // Init'd by ReadTrack() -> ImageReadTrack()
|
||||
LPBYTE trackimage;
|
||||
bool trackimagedata;
|
||||
bool trackimagedirty;
|
||||
|
||||
Disk_t()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
ZeroMemory(imagename, sizeof(imagename));
|
||||
ZeroMemory(fullname, sizeof(fullname));
|
||||
strFilenameInZip.clear();
|
||||
imagehandle = NULL;
|
||||
bWriteProtected = false;
|
||||
//
|
||||
byte = 0;
|
||||
nibbles = 0;
|
||||
trackimage = NULL;
|
||||
trackimagedata = false;
|
||||
trackimagedirty = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
|
||||
WORD currdrive;
|
||||
Drive_t g_aFloppyDrive[NUM_DRIVES];
|
||||
BYTE floppylatch;
|
||||
BOOL floppymotoron;
|
||||
BOOL floppyloadmode; // for efficiency this is not used; it's extremely unlikely to affect emulation (nickw)
|
||||
BOOL floppywritemode;
|
||||
WORD phases; // state bits for stepper magnet phases 0 - 3
|
||||
bool g_bSaveDiskImage;
|
||||
UINT g_uSlot;
|
||||
unsigned __int64 g_uDiskLastCycle;
|
||||
unsigned __int64 g_uDiskLastReadLatchCycle;
|
||||
FormatTrack g_formatTrack;
|
||||
bool 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 g_bLogDisk_NibblesRW; // From VS Debugger, change this to true/false during runtime for precise nibble logging
|
||||
#endif
|
||||
#if LOG_DISK_NIBBLES_WRITE
|
||||
UINT64 g_uWriteLastCycle;
|
||||
UINT g_uSyncFFCount;
|
||||
#endif
|
||||
};
|
||||
|
@ -45,8 +45,6 @@ Writes the following: (in 1 continuous write operation)
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Disk.h"
|
||||
#include "DiskLog.h"
|
||||
#include "DiskFormatTrack.h"
|
||||
#include "Log.h"
|
||||
#include "YamlHelper.h"
|
||||
|
||||
|
@ -35,15 +35,15 @@ public:
|
||||
|
||||
void Reset(void);
|
||||
void DriveNotWritingTrack(void);
|
||||
void DriveSwitchedToReadMode(Disk_t* const pFloppy);
|
||||
void DriveSwitchedToReadMode(struct Disk_t* const pFloppy);
|
||||
void DriveSwitchedToWriteMode(UINT uTrackIndex);
|
||||
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 LoadSnapshot(class YamlLoadHelper& yamlLoadHelper);
|
||||
|
||||
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);
|
||||
|
||||
BYTE m_VolTrkSecChk[4];
|
||||
|
Loading…
Reference in New Issue
Block a user