mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-01 13:58:20 +00:00
Adds a basic implementation of the non-instantaneous index pulse.
This commit is contained in:
parent
dfa6b11737
commit
f633cf4c3f
@ -182,6 +182,9 @@ void Drive::advance(const Cycles cycles) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Drive::run_for(const Cycles cycles) {
|
void Drive::run_for(const Cycles cycles) {
|
||||||
|
// Assumed: the index pulse pulses even if the drive has stopped spinning.
|
||||||
|
index_pulse_remaining_ = std::max(index_pulse_remaining_ - cycles, Cycles(0));
|
||||||
|
|
||||||
if(motor_is_on_) {
|
if(motor_is_on_) {
|
||||||
if(has_disk_) {
|
if(has_disk_) {
|
||||||
Time zero(0);
|
Time zero(0);
|
||||||
@ -262,6 +265,11 @@ void Drive::get_next_event(float duration_already_passed) {
|
|||||||
current_event_.type = Track::Event::IndexHole;
|
current_event_.type = Track::Event::IndexHole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Begin a 2ms period of holding the index line pulse active if this is an index pulse event.
|
||||||
|
if(current_event_.type == Track::Event::IndexHole) {
|
||||||
|
index_pulse_remaining_ = Cycles((get_input_clock_rate() * 2) / 1000);
|
||||||
|
}
|
||||||
|
|
||||||
// divide interval, which is in terms of a single rotation of the disk, by rotation speed to
|
// divide interval, which is in terms of a single rotation of the disk, by rotation speed to
|
||||||
// convert it into revolutions per second; this is achieved by multiplying by rotational_multiplier_
|
// convert it into revolutions per second; this is achieved by multiplying by rotational_multiplier_
|
||||||
float interval = std::max((current_event_.length - duration_already_passed) * rotational_multiplier_, 0.0f);
|
float interval = std::max((current_event_.length - duration_already_passed) * rotational_multiplier_, 0.0f);
|
||||||
|
Loading…
Reference in New Issue
Block a user