From 9cb902cc4fe4558a116843091296632a18db5ae6 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 28 Dec 2016 22:34:22 -0500 Subject: [PATCH] Experimentally marked ADF as writable too, immediately discovering a mistake in the analysing MFM decoder. --- Storage/Disk/Encodings/MFM.cpp | 12 ++++++++---- Storage/Disk/Formats/AcornADF.cpp | 5 +++++ Storage/Disk/Formats/AcornADF.hpp | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Storage/Disk/Encodings/MFM.cpp b/Storage/Disk/Encodings/MFM.cpp index 0fa77b9ff..102815d07 100644 --- a/Storage/Disk/Encodings/MFM.cpp +++ b/Storage/Disk/Encodings/MFM.cpp @@ -319,7 +319,8 @@ std::shared_ptr Parser::get_next_sector() while(index_count_ < 2) { // look for an ID address mark - while(1) + bool id_found = false; + while(!id_found) { run_for_cycles(1); if(is_mfm_) @@ -330,6 +331,7 @@ std::shared_ptr Parser::get_next_sector() if(mark == Storage::Encodings::MFM::MFMIDAddressByte) { crc_generator_.set_value(MFMPostSyncCRCValue); + id_found = true; break; } } @@ -339,7 +341,7 @@ std::shared_ptr Parser::get_next_sector() if(shift_register_ == Storage::Encodings::MFM::FMIDAddressMark) { crc_generator_.reset(); - break; + id_found = true; } } if(index_count_ >= 2) return nullptr; @@ -355,7 +357,8 @@ std::shared_ptr Parser::get_next_sector() if((header_crc & 0xff) != get_next_byte()) continue; // look for data mark - while(1) + bool data_found = false; + while(!data_found) { run_for_cycles(1); if(is_mfm_) @@ -366,6 +369,7 @@ std::shared_ptr Parser::get_next_sector() if(mark == Storage::Encodings::MFM::MFMDataAddressByte) { crc_generator_.set_value(MFMPostSyncCRCValue); + data_found = true; break; } if(mark == Storage::Encodings::MFM::MFMIDAddressByte) return nullptr; @@ -376,7 +380,7 @@ std::shared_ptr Parser::get_next_sector() if(shift_register_ == Storage::Encodings::MFM::FMDataAddressMark) { crc_generator_.reset(); - break; + data_found = true; } if(shift_register_ == Storage::Encodings::MFM::FMIDAddressMark) return nullptr; } diff --git a/Storage/Disk/Formats/AcornADF.cpp b/Storage/Disk/Formats/AcornADF.cpp index 5eb7d7dce..9efd45811 100644 --- a/Storage/Disk/Formats/AcornADF.cpp +++ b/Storage/Disk/Formats/AcornADF.cpp @@ -47,6 +47,11 @@ unsigned int AcornADF::get_head_count() return 1; } +bool AcornADF::get_is_read_only() +{ + return is_read_only_; +} + std::shared_ptr AcornADF::get_uncached_track_at_position(unsigned int head, unsigned int position) { std::shared_ptr track; diff --git a/Storage/Disk/Formats/AcornADF.hpp b/Storage/Disk/Formats/AcornADF.hpp index 11109d5ea..7be2d1b87 100644 --- a/Storage/Disk/Formats/AcornADF.hpp +++ b/Storage/Disk/Formats/AcornADF.hpp @@ -35,6 +35,7 @@ class AcornADF: public Disk, public Storage::FileHolder { // implemented to satisfy @c Disk unsigned int get_head_position_count(); unsigned int get_head_count(); + bool get_is_read_only(); private: std::shared_ptr get_uncached_track_at_position(unsigned int head, unsigned int position); };