mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Reroutes all Disk II types through the Disk II analyser and returns actual sector from the Apple GCR parser results.
This commit is contained in:
parent
c36d7b4972
commit
ba7fbc4032
@ -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<Target>(new Target);
|
||||
target->machine = Machine::AppleII;
|
||||
|
@ -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<Storage::Disk::D64>, TargetPlatform::Commodore) // D64
|
||||
Format("dmk", result.disks, Disk::DiskImageHolder<Storage::Disk::DMK>, TargetPlatform::MSX) // DMK
|
||||
Format("do", result.disks, Disk::DiskImageHolder<Storage::Disk::AppleDSK>, TargetPlatform::AppleII) // DO
|
||||
Format("do", result.disks, Disk::DiskImageHolder<Storage::Disk::AppleDSK>, TargetPlatform::DiskII) // DO
|
||||
Format("dsd", result.disks, Disk::DiskImageHolder<Storage::Disk::SSD>, TargetPlatform::Acorn) // DSD
|
||||
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::CPCDSK>, TargetPlatform::AmstradCPC) // DSK (Amstrad CPC)
|
||||
Format("dsk", result.disks, Disk::DiskImageHolder<Storage::Disk::AppleDSK>, TargetPlatform::DiskII) // DSK (Apple)
|
||||
@ -107,10 +107,10 @@ static Media GetMediaAndPlatforms(const std::string &file_name, TargetPlatform::
|
||||
Disk::DiskImageHolder<Storage::Disk::HFE>,
|
||||
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<Storage::Disk::NIB>, TargetPlatform::AppleII) // NIB
|
||||
Format("nib", result.disks, Disk::DiskImageHolder<Storage::Disk::NIB>, 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<Storage::Disk::AppleDSK>, TargetPlatform::AppleII) // PO
|
||||
Format("po", result.disks, Disk::DiskImageHolder<Storage::Disk::AppleDSK>, 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<Storage::Disk::WOZ>, TargetPlatform::AppleII) // WOZ
|
||||
Format("woz", result.disks, Disk::DiskImageHolder<Storage::Disk::WOZ>, TargetPlatform::DiskII) // WOZ
|
||||
|
||||
#undef Format
|
||||
#undef Insert
|
||||
|
@ -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) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ std::map<std::size_t, Sector> Storage::Encodings::AppleGCR::sectors_from_segment
|
||||
|
||||
const std::size_t scanning_sentinel = std::numeric_limits<std::size_t>::max();
|
||||
std::unique_ptr<Sector> new_sector;
|
||||
std::size_t sector_location = 0;
|
||||
std::size_t pointer = scanning_sentinel;
|
||||
std::array<uint_fast8_t, 8> header{{0, 0, 0, 0, 0, 0, 0, 0}};
|
||||
std::array<uint_fast8_t, 3> scanner;
|
||||
@ -74,6 +75,8 @@ std::map<std::size_t, Sector> 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<std::size_t>(bit);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -147,6 +150,9 @@ std::map<std::size_t, Sector> 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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user