From af69b21033ebcf73c9ed8e17f90c1f268ccc5aad Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 24 Dec 2016 22:51:26 -0500 Subject: [PATCH] This is almost complete, except that it doesn't act appropriately if some bits are written but not enough to cover the entire writing period. --- Storage/Disk/DiskController.cpp | 12 +++++++++++- Storage/Disk/DiskController.hpp | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Storage/Disk/DiskController.cpp b/Storage/Disk/DiskController.cpp index b8ab35eef..67a4faacf 100644 --- a/Storage/Disk/DiskController.cpp +++ b/Storage/Disk/DiskController.cpp @@ -30,6 +30,11 @@ Controller::Controller(unsigned int clock_rate, unsigned int clock_rate_multipli void Controller::setup_track() { + if(patched_track_) + { + drive_->set_track(patched_track_); + } + track_ = drive_->get_track(); track_is_dirty_ = false; @@ -143,7 +148,12 @@ void Controller::write_bit(bool value) void Controller::end_writing() { is_reading_ = true; - // TODO + + if(!patched_track_) + { + patched_track_.reset(new PCMPatchedTrack(track_)); + } + patched_track_->add_segment(write_start_time_, write_segment_); } #pragma mark - PLL control and delegate diff --git a/Storage/Disk/DiskController.hpp b/Storage/Disk/DiskController.hpp index 69297cec4..d2d6cfba3 100644 --- a/Storage/Disk/DiskController.hpp +++ b/Storage/Disk/DiskController.hpp @@ -12,6 +12,7 @@ #include "Drive.hpp" #include "DigitalPhaseLockedLoop.hpp" #include "PCMSegment.hpp" +#include "PCMPatchedTrack.hpp" #include "../TimedEventLoop.hpp" namespace Storage { @@ -116,6 +117,7 @@ class Controller: public DigitalPhaseLockedLoop::Delegate, public TimedEventLoop bool is_reading_; bool track_is_dirty_; + std::shared_ptr patched_track_; PCMSegment write_segment_; Time write_start_time_;