mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-27 16:31:31 +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)
|
||||
{
|
||||
// TODO:
|
||||
// bit 0 => enable or disable drive 1
|
||||
// bit 1 => enable or disable drive 2
|
||||
// bit 2 => side 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;
|
||||
default: selected_drive_ = 0; set_drive(drives_[0]); break;
|
||||
case 2: selected_drive_ = 1; set_drive(drives_[1]); break;
|
||||
switch(control&3)
|
||||
{
|
||||
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(drives_[1]) drives_[1]->set_head((control & 0x04) ? 1 : 0);
|
||||
set_is_double_density(!(control & 0x08));
|
||||
if(changes & 0x04)
|
||||
{
|
||||
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:
|
||||
std::shared_ptr<Storage::Disk::Drive> drives_[2];
|
||||
int selected_drive_;
|
||||
uint8_t last_control_;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -49,6 +49,10 @@ class Controller: public DigitalPhaseLockedLoop::Delegate, public TimedEventLoop
|
||||
Sets the current 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();
|
||||
|
||||
/*!
|
||||
|
Loading…
Reference in New Issue
Block a user