mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-07 23:29:06 +00:00
Made the Plus 3 less chatty, documented invalidate_track
.
This commit is contained in:
parent
26710c988d
commit
4fca30b81f
@ -24,18 +24,28 @@ void Plus3::set_disk(std::shared_ptr<Storage::Disk::Disk> disk, int drive)
|
|||||||
|
|
||||||
void Plus3::set_control_register(uint8_t control)
|
void Plus3::set_control_register(uint8_t control)
|
||||||
{
|
{
|
||||||
// TODO:
|
|
||||||
// bit 0 => enable or disable drive 1
|
// bit 0 => enable or disable drive 1
|
||||||
// bit 1 => enable or disable drive 2
|
// bit 1 => enable or disable drive 2
|
||||||
// bit 2 => side select
|
// bit 2 => side select
|
||||||
// bit 3 => single density select
|
// bit 3 => single density select
|
||||||
switch(control&3)
|
|
||||||
|
uint8_t changes = control ^ last_control_;
|
||||||
|
last_control_ = control;
|
||||||
|
|
||||||
|
if(changes&3)
|
||||||
{
|
{
|
||||||
case 0: selected_drive_ = -1; set_drive(nullptr); break;
|
switch(control&3)
|
||||||
default: selected_drive_ = 0; set_drive(drives_[0]); break;
|
{
|
||||||
case 2: selected_drive_ = 1; set_drive(drives_[1]); break;
|
case 0: selected_drive_ = -1; set_drive(nullptr); break;
|
||||||
|
default: selected_drive_ = 0; set_drive(drives_[0]); break;
|
||||||
|
case 2: selected_drive_ = 1; set_drive(drives_[1]); break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(drives_[0]) drives_[0]->set_head((control & 0x04) ? 1 : 0);
|
if(changes & 0x04)
|
||||||
if(drives_[1]) drives_[1]->set_head((control & 0x04) ? 1 : 0);
|
{
|
||||||
set_is_double_density(!(control & 0x08));
|
invalidate_track();
|
||||||
|
if(drives_[0]) drives_[0]->set_head((control & 0x04) ? 1 : 0);
|
||||||
|
if(drives_[1]) drives_[1]->set_head((control & 0x04) ? 1 : 0);
|
||||||
|
}
|
||||||
|
if(changes & 0x08) set_is_double_density(!(control & 0x08));
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ class Plus3 : public WD::WD1770 {
|
|||||||
private:
|
private:
|
||||||
std::shared_ptr<Storage::Disk::Drive> drives_[2];
|
std::shared_ptr<Storage::Disk::Drive> drives_[2];
|
||||||
int selected_drive_;
|
int selected_drive_;
|
||||||
|
uint8_t last_control_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,10 @@ class Controller: public DigitalPhaseLockedLoop::Delegate, public TimedEventLoop
|
|||||||
Sets the current drive.
|
Sets the current drive.
|
||||||
*/
|
*/
|
||||||
void set_drive(std::shared_ptr<Drive> drive);
|
void set_drive(std::shared_ptr<Drive> drive);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Announces that the track the drive sees is about to change for a reason unknownt to the controller.
|
||||||
|
*/
|
||||||
void invalidate_track();
|
void invalidate_track();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Loading…
Reference in New Issue
Block a user