Exemplo n.º 1
0
/* floppy disc interface set drive */
void FDI_SetPhysicalDrive(unsigned long Value)
{
	/* map fdc drive output to physical drive selects */
	fdi.PhysicalDrive = Value & FDI_DriveMask;
	fdi.PhysicalDrive = fdi.PhysicalDrive ^ FDI_DriveSwitch;

	fdi.drive = FDD_GetDrive(fdi.PhysicalDrive);
}
Exemplo n.º 2
0
void	FDD_Initialise(int Drive)
{
	FDD *drive = FDD_GetDrive(Drive);

	/* set default side */
//	drive->PhysicalSide = 0;

	drive->Flags |= FDD_FLAGS_DRIVE_ENABLED;
	drive->Flags &= ~(FDD_FLAGS_DISK_PRESENT | FDD_FLAGS_WRITE_PROTECTED);

}
Exemplo n.º 3
0
/* the disc light comes on for a read/write operation only */
void	FDD_LED_SetState(unsigned long Drive, int LedState)
{
	FDD *drive = FDD_GetDrive(Drive);

	if (LedState)
	{
		drive->Flags &=~FDD_FLAGS_LED_ON;
	}
	else
	{
		drive->Flags |= FDD_FLAGS_LED_ON;
	}
}
Exemplo n.º 4
0
void    FDD_Enable(int Drive, BOOL bState)
{
    FDD *drive = FDD_GetDrive(Drive);

    if (bState)
    {
        drive->Flags |= FDD_FLAGS_DRIVE_ENABLED;
    }
    else
    {
        drive->Flags &=~FDD_FLAGS_DRIVE_ENABLED;
    }
}
Exemplo n.º 5
0
void	FDD_Initialise(int Drive)
{
	FDD *drive = FDD_GetDrive(Drive);

    drive->CurrentTrack = 1;
    drive->CurrentIDIndex = 0;
    /* set default side */
	drive->PhysicalSide = 0;
    /* set flags */
	drive->Flags = 0;

	FDD_RefreshWriteProtect(Drive);
	FDD_RefreshMotorState(Drive);
}
Exemplo n.º 6
0
/* insert or remove a disk from a drive */
void	FDD_InsertDisk(int Drive,BOOL Status)
{
	FDD *drive = FDD_GetDrive(Drive);

	/* say disk is or isn't present */
	drive->Flags &=~FDD_FLAGS_DISK_PRESENT;
	
	if (Status)
	{
		drive->Flags |= FDD_FLAGS_DISK_PRESENT;
	}
	/* set appropiate drive status */

//	FDC_SetDriveStatus(Drive);

	/* setup initial parameters for when a disk is present */
	drive->CurrentIDIndex = 0;

}
Exemplo n.º 7
0
/* insert or remove a disk from a drive */
void	FDD_InsertDisk(int Drive,BOOL Status)
{
	FDD *drive = FDD_GetDrive(Drive);

	/* say disk is or isn't present */
	drive->Flags &=~FDD_FLAGS_DISK_PRESENT;

	if (Status)
	{
		drive->Flags |= FDD_FLAGS_DISK_PRESENT;
	}

	/* setup initial parameters for when a disk is present */
	drive->CurrentIDIndex = 0;

	/* refresh motor state */
	FDD_RefreshMotorState(Drive);

    /* refresh write protect status that is reported */
    FDD_RefreshWriteProtect(Drive);
}
Exemplo n.º 8
0
/* perform the actual step */
void	FDD_PerformStep(unsigned long DriveIndex, signed int StepDirection)
{
	FDD *theDrive;
	int CurrentTrack;
	int Flags;

	theDrive = FDD_GetDrive(DriveIndex);
	
	/* perform step */
	CurrentTrack = theDrive->CurrentTrack;
	CurrentTrack += StepDirection;

	/* range check head position */
	if (CurrentTrack<0)
	{
		CurrentTrack = 0;
	}
	else
	if (CurrentTrack>=theDrive->NumberOfTracks)
	{
		CurrentTrack = theDrive->NumberOfTracks-1;
	}

	Flags = theDrive->Flags;
	Flags &= ~FDD_FLAGS_HEAD_AT_TRACK_0;

	/* head at track 0? */
	if (CurrentTrack == 0)
	{
		/* yes */
		Flags |= FDD_FLAGS_HEAD_AT_TRACK_0;
	}
	
	theDrive->Flags = Flags;

	theDrive->CurrentTrack = CurrentTrack;

	theDrive->CurrentIDIndex = 0;
}
Exemplo n.º 9
0
void	FDD_SetMotorState(int Drive, int MotorState)
{
	BOOL bReady = FALSE;
	FDD *drive = FDD_GetDrive(Drive);

	/* drive enabled? */
	if (drive->Flags & FDD_FLAGS_DRIVE_ENABLED)
	{
		/* disk present? */
		if (drive->Flags & FDD_FLAGS_DISK_PRESENT)
		{
			/* motor on? */
			if (MotorState!=0)
				bReady = TRUE;
		}
	}

	if (bReady)
		drive->Flags |=FDD_FLAGS_DRIVE_READY;
	else
		drive->Flags &=~FDD_FLAGS_DRIVE_READY;
}
Exemplo n.º 10
0
void	FDD_RefreshMotorState(int Drive)
{
    /* really need a delay before drive becomes ready! */
	BOOL bReady = FALSE;
	FDD *drive = FDD_GetDrive(Drive);

	/* drive enabled? */
	if (drive->Flags & FDD_FLAGS_DRIVE_ENABLED)
	{
		/* disk present? */
		if (drive->Flags & FDD_FLAGS_DISK_PRESENT)
		{
			/* motor on? */
			if (FDI_GetMotorState())
				bReady = TRUE;
		}
	}

	if (bReady)
		drive->Flags |=FDD_FLAGS_DRIVE_READY;
	else
		drive->Flags &=~FDD_FLAGS_DRIVE_READY;
}
Exemplo n.º 11
0
int		FDD_LED_GetState(unsigned long Drive)
{
	FDD *drive = FDD_GetDrive(Drive);

	return ((drive->Flags & FDD_FLAGS_LED_ON)!=0);
}
Exemplo n.º 12
0
/* turn disk in the drive */
void	FDD_TurnDisk(int Drive)
{
	FDD *drive = FDD_GetDrive(Drive);

//	drive->PhysicalSide^=0x01;
}
Exemplo n.º 13
0
BOOL	FDD_IsDiskPresent(int Drive)
{
	return FDD_GetDrive(Drive)->Flags & FDD_FLAGS_DISK_PRESENT;
}
Exemplo n.º 14
0
BOOL    FDD_GetDiskSideA(int Drive)
{
	FDD *drive = FDD_GetDrive(Drive);

    return (drive->PhysicalSide==0);
}
Exemplo n.º 15
0
BOOL    FDD_IsEnabled(int Drive)
{
    FDD *drive = FDD_GetDrive(Drive);
    return ((drive->Flags & FDD_FLAGS_DRIVE_ENABLED)!=0);
}
Exemplo n.º 16
0
int     FDD_GetPhysicalSide(int Drive)
{
    FDD *drive = FDD_GetDrive(Drive);

    return drive->PhysicalSide;
}