DriveController.java
package libsidplay.components.c1541;
import java.io.File;
import java.io.IOException;
/**
* Media and mechanical state shared by GCR and MFM disk controllers.
*/
public interface DriveController {
/**
* Attach a disk image to the controller.
*
* @param file disk image file
* @return attached disk image
* @throws IOException image could not be read or pending changes could not be written
*/
DiskImage insertDisk(File file) throws IOException;
/**
* Write pending changes and detach the current disk image.
*
* @throws IOException pending image data could not be written
*/
void ejectDisk() throws IOException;
/**
* Get the head position in half-tracks, with track 1 at half-track 2.
*
* @return current half-track
*/
int getHalfTrack();
/**
* Get the selected physical head. Single-sided controllers always select head 0.
*
* @return selected head (0 or 1)
*/
default int getSide() {
return 0;
}
/**
* Is the drive activity LED on?
*
* @return true if the LED is on
*/
boolean isLEDOn();
/**
* Is the disk motor on?
*
* @return true if the motor is on
*/
boolean isMotorOn();
}