mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-16 18:30:32 +00:00
Corrected wiring to get advance
signals through to Drive event delegates.
This commit is contained in:
parent
0622187ddf
commit
8882aa496f
@ -48,7 +48,7 @@ void Controller::process_event(const Track::Event &event) {
|
||||
}
|
||||
|
||||
void Controller::advance(const Cycles cycles) {
|
||||
pll_->run_for(cycles);
|
||||
pll_->run_for(Cycles(cycles.as_int() * clock_rate_multiplier_));
|
||||
}
|
||||
|
||||
void Controller::process_write_completed() {
|
||||
|
@ -91,6 +91,10 @@ void Drive::set_event_delegate(Storage::Disk::Drive::EventDelegate *delegate) {
|
||||
event_delegate_ = delegate;
|
||||
}
|
||||
|
||||
void Drive::advance(const Cycles cycles) {
|
||||
if(event_delegate_) event_delegate_->advance(cycles);
|
||||
}
|
||||
|
||||
void Drive::run_for(const Cycles cycles) {
|
||||
Time zero(0);
|
||||
|
||||
@ -111,9 +115,7 @@ void Drive::run_for(const Cycles cycles) {
|
||||
cycles_since_index_hole_ += (unsigned int)cycles_to_run_for;
|
||||
|
||||
number_of_cycles -= cycles_to_run_for;
|
||||
if(is_reading_) {
|
||||
if(event_delegate_) event_delegate_->advance(Cycles(cycles_to_run_for));
|
||||
} else {
|
||||
if(!is_reading_) {
|
||||
if(cycles_until_bits_written_ > zero) {
|
||||
Storage::Time cycles_to_run_for_time(cycles_to_run_for);
|
||||
if(cycles_until_bits_written_ <= cycles_to_run_for_time) {
|
||||
@ -152,6 +154,7 @@ void Drive::get_next_event(const Time &duration_already_passed) {
|
||||
|
||||
void Drive::process_next_event() {
|
||||
// TODO: ready test here.
|
||||
if(current_event_.type == Track::Event::IndexHole) cycles_since_index_hole_ = 0;
|
||||
if(event_delegate_) event_delegate_->process_event(current_event_);
|
||||
get_next_event(Time(0));
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ class Drive: public Sleeper, public TimedEventLoop {
|
||||
|
||||
// If the drive is not currently reading then it is writing. While writing
|
||||
// it can optionally be told to clamp to the index hole.
|
||||
bool is_reading_ = false;
|
||||
bool is_reading_ = true;
|
||||
bool clamp_writing_to_index_hole_ = false;
|
||||
|
||||
// If writing is occurring then the drive will be accumulating a write segment,
|
||||
@ -166,6 +166,7 @@ class Drive: public Sleeper, public TimedEventLoop {
|
||||
// TimedEventLoop call-ins and state.
|
||||
void process_next_event();
|
||||
void get_next_event(const Time &duration_already_passed);
|
||||
void advance(const Cycles cycles);
|
||||
Track::Event current_event_;
|
||||
|
||||
// Helper for track changes.
|
||||
|
@ -426,7 +426,6 @@ std::vector<uint8_t> Parser::get_track() {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<Sector> Parser::get_next_sector() {
|
||||
std::shared_ptr<Sector> sector(new Sector);
|
||||
index_count_ = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user