mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-08-07 17:25:08 +00:00
superdrive: implement eject disk command.
This commit is contained in:
@@ -35,9 +35,15 @@ MacSuperDrive::MacSuperDrive()
|
|||||||
this->name = "Superdrive";
|
this->name = "Superdrive";
|
||||||
this->supported_types = HWCompType::FLOPPY_DRV;
|
this->supported_types = HWCompType::FLOPPY_DRV;
|
||||||
|
|
||||||
|
this->eject_latch = 0; // eject latch is off
|
||||||
|
|
||||||
|
this->reset_params();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MacSuperDrive::reset_params()
|
||||||
|
{
|
||||||
this->media_kind = MediaKind::high_density;
|
this->media_kind = MediaKind::high_density;
|
||||||
this->has_disk = 0; // drive is empty
|
this->has_disk = 0; // drive is empty
|
||||||
this->eject_latch = 0; // eject latch is off
|
|
||||||
this->drive_mode = RecMethod::MFM; // assume MFM mode by default
|
this->drive_mode = RecMethod::MFM; // assume MFM mode by default
|
||||||
this->motor_stat = 0; // spindle motor is off
|
this->motor_stat = 0; // spindle motor is off
|
||||||
this->cur_track = 0; // current head position
|
this->cur_track = 0; // current head position
|
||||||
@@ -74,6 +80,12 @@ void MacSuperDrive::command(uint8_t addr, uint8_t value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CommandAddr::Eject_Disk:
|
||||||
|
if (value) {
|
||||||
|
LOG_F(INFO, "Superdrive: disk ejected");
|
||||||
|
this->eject_latch = 1;
|
||||||
|
this->reset_params();
|
||||||
|
}
|
||||||
case CommandAddr::Reset_Eject_Latch:
|
case CommandAddr::Reset_Eject_Latch:
|
||||||
if (value) {
|
if (value) {
|
||||||
this->eject_latch = 0;
|
this->eject_latch = 0;
|
||||||
|
@@ -56,6 +56,7 @@ enum CommandAddr : uint8_t {
|
|||||||
Step_Direction = 0,
|
Step_Direction = 0,
|
||||||
Do_Step = 1,
|
Do_Step = 1,
|
||||||
Motor_On_Off = 2,
|
Motor_On_Off = 2,
|
||||||
|
Eject_Disk = 3,
|
||||||
Reset_Eject_Latch = 4,
|
Reset_Eject_Latch = 4,
|
||||||
Switch_Drive_Mode = 5,
|
Switch_Drive_Mode = 5,
|
||||||
};
|
};
|
||||||
@@ -94,6 +95,7 @@ public:
|
|||||||
char* get_sector_data_ptr(int sector_num);
|
char* get_sector_data_ptr(int sector_num);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void reset_params();
|
||||||
void set_disk_phys_params();
|
void set_disk_phys_params();
|
||||||
void switch_drive_mode(int mode);
|
void switch_drive_mode(int mode);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user