From b9fad184d789f25f730ff612dcabd138472e428e Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 28 Dec 2016 23:00:47 -0500 Subject: [PATCH] Added just enough for a complete manual test of writing to a .ADF with the 1770 then getting the correct result parsing it back on the host side in order potentially to update a file. ... which means that now it's time to worry about when and how mounted files should actually update themselves. Which will make for some fun with threading, I dare say. --- Storage/Disk/Formats/AcornADF.cpp | 23 +++++++++++++++++++++++ Storage/Disk/Formats/AcornADF.hpp | 1 + 2 files changed, 24 insertions(+) diff --git a/Storage/Disk/Formats/AcornADF.cpp b/Storage/Disk/Formats/AcornADF.cpp index 9efd45811..b1e8d0794 100644 --- a/Storage/Disk/Formats/AcornADF.cpp +++ b/Storage/Disk/Formats/AcornADF.cpp @@ -37,6 +37,29 @@ AcornADF::AcornADF(const char *file_name) : if(bytes[0] != 'H' || bytes[1] != 'u' || bytes[2] != 'g' || bytes[3] != 'o') throw ErrorNotAcornADF; } +AcornADF::~AcornADF() +{ + if(get_is_modified()) + { + for(unsigned int head = 0; head < get_head_count(); head++) + { + for(unsigned int track = 0; track < get_head_position_count(); track++) + { + std::shared_ptr modified_track = get_modified_track_at_position(head, track); + if(modified_track) + { + Storage::Encodings::MFM::Parser parser(true, modified_track); + for(unsigned int c = 0; c < sectors_per_track; c++) + { + std::shared_ptr sector = parser.get_sector((uint8_t)track, (uint8_t)c); + printf("Sector %d: %p\n", c, sector.get()); + } + } + } + } + } +} + unsigned int AcornADF::get_head_position_count() { return 80; diff --git a/Storage/Disk/Formats/AcornADF.hpp b/Storage/Disk/Formats/AcornADF.hpp index 7be2d1b87..ea996303f 100644 --- a/Storage/Disk/Formats/AcornADF.hpp +++ b/Storage/Disk/Formats/AcornADF.hpp @@ -27,6 +27,7 @@ class AcornADF: public Disk, public Storage::FileHolder { @throws ErrorNotAcornADF if the file doesn't appear to contain an Acorn .ADF format image. */ AcornADF(const char *file_name); + ~AcornADF(); enum { ErrorNotAcornADF,