2019-07-10 20:05:59 +00:00
|
|
|
//
|
|
|
|
// MacintoshDoubleDensityDrive.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 10/07/2019.
|
|
|
|
// Copyright © 2019 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2024-01-17 04:34:46 +00:00
|
|
|
#pragma once
|
2019-07-10 20:05:59 +00:00
|
|
|
|
|
|
|
#include "IWM.hpp"
|
|
|
|
|
2023-05-10 21:02:18 +00:00
|
|
|
namespace Apple::Macintosh {
|
2019-07-10 20:05:59 +00:00
|
|
|
|
|
|
|
class DoubleDensityDrive: public IWMDrive {
|
|
|
|
public:
|
|
|
|
DoubleDensityDrive(int input_clock_rate, bool is_800k);
|
|
|
|
|
2019-07-30 19:08:55 +00:00
|
|
|
/*!
|
|
|
|
@returns @c true if this is an 800kb drive; @c false otherwise.
|
|
|
|
*/
|
2020-11-21 02:37:17 +00:00
|
|
|
bool is_800k() const {
|
2019-07-30 19:08:55 +00:00
|
|
|
return is_800k_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Sets the current rotation speed of this drive only if it is a 400kb drive.
|
|
|
|
800kb drives select their own rotation speed based on head position,
|
|
|
|
and ignore this input.
|
|
|
|
*/
|
|
|
|
void set_rotation_speed(float revolutions_per_minute);
|
|
|
|
|
2019-07-10 20:05:59 +00:00
|
|
|
private:
|
2020-01-24 03:57:51 +00:00
|
|
|
void set_enabled(bool) final;
|
|
|
|
void set_control_lines(int) final;
|
|
|
|
bool read() final;
|
|
|
|
|
2019-07-10 20:05:59 +00:00
|
|
|
// To receive the proper notifications from Storage::Disk::Drive.
|
2020-01-24 03:57:51 +00:00
|
|
|
void did_step(Storage::Disk::HeadPosition to_position) final;
|
2020-11-18 22:20:48 +00:00
|
|
|
void did_set_disk(bool) final;
|
2019-07-10 20:05:59 +00:00
|
|
|
|
2019-07-12 17:17:24 +00:00
|
|
|
const bool is_800k_;
|
|
|
|
bool has_new_disk_ = false;
|
|
|
|
int control_state_ = 0;
|
|
|
|
int step_direction_ = 1;
|
2019-07-10 20:05:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|