1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-25 11:17:26 +00:00

Sets things up to allow variable rotation rates, and especially Sony 800kb-style self-selecting rates.

This commit is contained in:
Thomas Harte
2019-06-04 21:41:54 -04:00
parent b8a1553368
commit 833258f3d7
5 changed files with 105 additions and 2 deletions
+15
View File
@@ -36,6 +36,14 @@ Drive::Drive(unsigned int input_clock_rate, int revolutions_per_minute, int numb
}
}
Drive::Drive(unsigned int input_clock_rate, int number_of_heads) : Drive(input_clock_rate, 300, number_of_heads) {}
void Drive::set_rotation_speed(float revolutions_per_minute) {
// TODO: probably I should look into
// whether doing all this with quotients is really a good idea.
rotational_multiplier_ = Time(60.0f / revolutions_per_minute);
}
Drive::~Drive() {
if(disk_) disk_->flush_tracks();
}
@@ -75,6 +83,9 @@ void Drive::step(HeadPosition offset) {
if(head_position_ != old_head_position) {
track_ = nullptr;
}
// Allow a subclass to react, if desired.
did_step(head_position_);
}
std::shared_ptr<Track> Drive::step_to(HeadPosition offset) {
@@ -97,6 +108,10 @@ void Drive::set_head(int head) {
}
}
int Drive::get_head_count() {
return available_heads_;
}
Storage::Time Drive::get_time_into_track() {
// `result` will initially be amount of time since the index hole was seen as a
// proportion of a second; convert it into proportion of a rotation, simplify and return.