superdrive: implement eject disk command.

This commit is contained in:
Maxim Poliakovski 2022-09-04 10:58:34 +02:00
parent 585c5fd4ca
commit 76e0fab33a
2 changed files with 15 additions and 1 deletions

View File

@ -35,9 +35,15 @@ MacSuperDrive::MacSuperDrive()
this->name = "Superdrive";
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->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->motor_stat = 0; // spindle motor is off
this->cur_track = 0; // current head position
@ -74,6 +80,12 @@ void MacSuperDrive::command(uint8_t addr, uint8_t value)
}
}
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:
if (value) {
this->eject_latch = 0;

View File

@ -56,6 +56,7 @@ enum CommandAddr : uint8_t {
Step_Direction = 0,
Do_Step = 1,
Motor_On_Off = 2,
Eject_Disk = 3,
Reset_Eject_Latch = 4,
Switch_Drive_Mode = 5,
};
@ -94,6 +95,7 @@ public:
char* get_sector_data_ptr(int sector_num);
protected:
void reset_params();
void set_disk_phys_params();
void switch_drive_mode(int mode);