diff --git a/Analyser/Static/DiskII/StaticAnalyser.cpp b/Analyser/Static/DiskII/StaticAnalyser.cpp index 5cce37dfc..2c0cc8aef 100644 --- a/Analyser/Static/DiskII/StaticAnalyser.cpp +++ b/Analyser/Static/DiskII/StaticAnalyser.cpp @@ -21,6 +21,14 @@ Analyser::Static::TargetList Analyser::Static::DiskII::GetTargets(const Media &m auto sector_map = Storage::Encodings::AppleGCR::sectors_from_segment( Storage::Disk::track_serialisation(*track_zero, Storage::Time(1, 50000))); + const Storage::Encodings::AppleGCR::Sector *sector_zero = nullptr; + for(const auto &pair: sector_map) { + if(!pair.second.address.sector) { + sector_zero = &pair.second; + break; + } + } + using Target = Analyser::Static::AppleII::Target; auto target = std::unique_ptr(new Target); target->machine = Machine::AppleII; diff --git a/Analyser/Static/StaticAnalyser.cpp b/Analyser/Static/StaticAnalyser.cpp index 6011e6421..ba70d38b7 100644 --- a/Analyser/Static/StaticAnalyser.cpp +++ b/Analyser/Static/StaticAnalyser.cpp @@ -95,7 +95,7 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform:: Format("csw", result.tapes, Tape::CSW, TargetPlatform::AllTape) // CSW Format("d64", result.disks, Disk::DiskImageHolder, TargetPlatform::Commodore) // D64 Format("dmk", result.disks, Disk::DiskImageHolder, TargetPlatform::MSX) // DMK - Format("do", result.disks, Disk::DiskImageHolder, TargetPlatform::AppleII) // DO + Format("do", result.disks, Disk::DiskImageHolder, TargetPlatform::DiskII) // DO Format("dsd", result.disks, Disk::DiskImageHolder, TargetPlatform::Acorn) // DSD Format("dsk", result.disks, Disk::DiskImageHolder, TargetPlatform::AmstradCPC) // DSK (Amstrad CPC) Format("dsk", result.disks, Disk::DiskImageHolder, TargetPlatform::DiskII) // DSK (Apple) @@ -107,10 +107,10 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform:: Disk::DiskImageHolder, TargetPlatform::Acorn | TargetPlatform::AmstradCPC | TargetPlatform::Commodore | TargetPlatform::Oric) // HFE (TODO: switch to AllDisk once the MSX stops being so greedy) - Format("nib", result.disks, Disk::DiskImageHolder, TargetPlatform::AppleII) // NIB + Format("nib", result.disks, Disk::DiskImageHolder, TargetPlatform::DiskII) // NIB Format("o", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // O Format("p", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // P - Format("po", result.disks, Disk::DiskImageHolder, TargetPlatform::AppleII) // PO + Format("po", result.disks, Disk::DiskImageHolder, TargetPlatform::DiskII) // PO Format("p81", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // P81 // PRG @@ -135,7 +135,7 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform:: Format("tsx", result.tapes, Tape::TZX, TargetPlatform::MSX) // TSX Format("tzx", result.tapes, Tape::TZX, TargetPlatform::ZX8081) // TZX Format("uef", result.tapes, Tape::UEF, TargetPlatform::Acorn) // UEF (tape) - Format("woz", result.disks, Disk::DiskImageHolder, TargetPlatform::AppleII) // WOZ + Format("woz", result.disks, Disk::DiskImageHolder, TargetPlatform::DiskII) // WOZ #undef Format #undef Insert diff --git a/Storage/Disk/Encodings/AppleGCR/Sector.hpp b/Storage/Disk/Encodings/AppleGCR/Sector.hpp index 83611dd48..d9f6c568e 100644 --- a/Storage/Disk/Encodings/AppleGCR/Sector.hpp +++ b/Storage/Disk/Encodings/AppleGCR/Sector.hpp @@ -38,6 +38,22 @@ struct Sector { FiveAndThree, SixAndTwo }; Encoding encoding = Encoding::SixAndTwo; + + Sector() {} + + Sector(Sector &&rhs) : + address(rhs.address), + data(std::move(rhs.data)), + has_data_checksum_error(rhs.has_data_checksum_error), + has_header_checksum_error(rhs.has_header_checksum_error), + encoding(rhs.encoding) {} + + Sector(const Sector &rhs) : + address(rhs.address), + data(rhs.data), + has_data_checksum_error(rhs.has_data_checksum_error), + has_header_checksum_error(rhs.has_header_checksum_error), + encoding(rhs.encoding) {} }; } diff --git a/Storage/Disk/Encodings/AppleGCR/SegmentParser.cpp b/Storage/Disk/Encodings/AppleGCR/SegmentParser.cpp index 8b43bbfe0..557d7b8e2 100644 --- a/Storage/Disk/Encodings/AppleGCR/SegmentParser.cpp +++ b/Storage/Disk/Encodings/AppleGCR/SegmentParser.cpp @@ -42,6 +42,7 @@ std::map Storage::Encodings::AppleGCR::sectors_from_segment const std::size_t scanning_sentinel = std::numeric_limits::max(); std::unique_ptr new_sector; + std::size_t sector_location = 0; std::size_t pointer = scanning_sentinel; std::array header{{0, 0, 0, 0, 0, 0, 0, 0}}; std::array scanner; @@ -74,6 +75,8 @@ std::map Storage::Encodings::AppleGCR::sectors_from_segment if(scanner[2] == data_prologue[2]) { new_sector.reset(new Sector); new_sector->data.reserve(412); + } else { + sector_location = static_cast(bit); } } } else { @@ -147,6 +150,9 @@ std::map Storage::Encodings::AppleGCR::sectors_from_segment // Throw away the collection of two-bit chunks. sector->data.erase(sector->data.begin(), sector->data.end() - 256); + + // Add this sector to the map. + result.insert(std::make_pair(sector_location, std::move(*sector))); } else { new_sector->data.push_back(value); }