mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-28 02:32:08 +00:00
Removed hard-coded drive light status to enum proper
This commit is contained in:
parent
e8e92081b6
commit
a4cff52aff
@ -63,6 +63,8 @@ static BOOL floppymotoron = 0;
|
||||
static BOOL floppywritemode = 0;
|
||||
|
||||
static void ChecSpinning();
|
||||
static Disk_Status_e GetDriveLightStatus( const int iDrive );
|
||||
static bool IsDriveValid( const int iDrive );
|
||||
static void ReadTrack (int drive);
|
||||
static void RemoveDisk (int drive);
|
||||
static void WriteTrack (int drive);
|
||||
@ -76,6 +78,30 @@ void CheckSpinning () {
|
||||
FrameRefreshStatus(DRAW_LEDS);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
Disk_Status_e GetDriveLightStatus( const int iDrive )
|
||||
{
|
||||
if (IsDriveValid( iDrive ))
|
||||
{
|
||||
Disk_t *pFloppy = & g_aFloppyDisk[ iDrive ];
|
||||
|
||||
if (pFloppy->spinning)
|
||||
{
|
||||
if (pFloppy->writeprotected)
|
||||
return DISK_STATUS_PROT;
|
||||
|
||||
if (pFloppy->writelight)
|
||||
return DISK_STATUS_WRITE;
|
||||
else
|
||||
return DISK_STATUS_READ;
|
||||
}
|
||||
else
|
||||
return DISK_STATUS_OFF;
|
||||
}
|
||||
|
||||
return DISK_STATUS_OFF;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void GetImageTitle (LPCTSTR imagefilename, Disk_t * fptr)
|
||||
{
|
||||
@ -299,14 +325,17 @@ LPCTSTR DiskGetFullName (int drive) {
|
||||
return g_aFloppyDisk[drive].fullname;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
void DiskGetLightStatus (int *drive1, int *drive2) {
|
||||
*drive1 = g_aFloppyDisk[0].spinning ? g_aFloppyDisk[0].writelight ? 2
|
||||
: 1
|
||||
: 0;
|
||||
*drive2 = g_aFloppyDisk[1].spinning ? g_aFloppyDisk[1].writelight ? 2
|
||||
: 1
|
||||
: 0;
|
||||
void DiskGetLightStatus (int *pDisk1Status_, int *pDisk2Status_)
|
||||
{
|
||||
// *drive1 = g_aFloppyDisk[0].spinning ? g_aFloppyDisk[0].writelight ? 2 : 1 : 0;
|
||||
// *drive2 = g_aFloppyDisk[1].spinning ? g_aFloppyDisk[1].writelight ? 2 : 1 : 0;
|
||||
|
||||
if (pDisk1Status_)
|
||||
*pDisk1Status_ = GetDriveLightStatus( 0 );
|
||||
if (pDisk2Status_)
|
||||
*pDisk2Status_ = GetDriveLightStatus( 1 );
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
@ -321,7 +350,7 @@ void DiskInitialize () {
|
||||
ZeroMemory(&g_aFloppyDisk[loop],sizeof(Disk_t ));
|
||||
TCHAR imagefilename[MAX_PATH];
|
||||
_tcscpy(imagefilename,progdir);
|
||||
_tcscat(imagefilename,TEXT("MASTER.DSK"));
|
||||
_tcscat(imagefilename,TEXT("MASTER.DSK")); // TODO: Should remember last disk by user
|
||||
DiskInsert(0,imagefilename,0,0);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,18 @@ void DiskDestroy (); // no, doesn't "destroy" the disk image. DiskManagerShu
|
||||
void DiskBoot ();
|
||||
void DiskEject( const int iDrive );
|
||||
LPCTSTR DiskGetFullName (int);
|
||||
void DiskGetLightStatus (int *,int *);
|
||||
|
||||
|
||||
enum Disk_Status_e
|
||||
{
|
||||
DISK_STATUS_OFF ,
|
||||
DISK_STATUS_READ ,
|
||||
DISK_STATUS_WRITE,
|
||||
DISK_STATUS_PROT ,
|
||||
NUM_DISK_STATUS
|
||||
};
|
||||
void DiskGetLightStatus (int *pDisk1Status_,int *pDisk2Status_);
|
||||
|
||||
LPCTSTR DiskGetName (int);
|
||||
int DiskInsert (int,LPCTSTR,BOOL,BOOL);
|
||||
BOOL DiskIsSpinning ();
|
||||
|
Loading…
Reference in New Issue
Block a user