mirror of
https://github.com/TomHarte/CLK.git
synced 2025-04-11 14:37:37 +00:00
Adds code to deal with sector-free tracks.
This commit is contained in:
parent
b4befd57a9
commit
64517a02b7
@ -55,6 +55,24 @@ class TrackConstructor {
|
||||
}
|
||||
|
||||
std::shared_ptr<PCMTrack> get_track() {
|
||||
// If no contents are supplied, return an unformatted track.
|
||||
if(sectors_.empty() && track_data_.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// If no sectors are on this track, just encode the track data. STX allows speed
|
||||
// changes and fuzzy bits in sectors only.
|
||||
if(sectors_.empty()) {
|
||||
PCMSegment segment;
|
||||
std::unique_ptr<Storage::Encodings::MFM::Encoder> encoder = Storage::Encodings::MFM::GetMFMEncoder(segment.data);
|
||||
for(auto c: track_data_) {
|
||||
encoder->add_byte(c);
|
||||
}
|
||||
return std::make_shared<PCMTrack>(segment);
|
||||
}
|
||||
|
||||
// Otherwise, seek to encode the sectors, using the track data to
|
||||
// fill in the gaps (if provided).
|
||||
std::unique_ptr<Storage::Encodings::MFM::Encoder> encoder;
|
||||
std::unique_ptr<PCMSegment> segment;
|
||||
|
||||
@ -89,6 +107,14 @@ class TrackConstructor {
|
||||
encoder->add_byte(0x4e);
|
||||
}
|
||||
|
||||
// while(segment->data.size() < track_size_ * 16) {
|
||||
// encoder->add_byte(0x4e);
|
||||
// }
|
||||
|
||||
while(segment->data.size() < 6250 * 16) {
|
||||
encoder->add_byte(0x4e);
|
||||
}
|
||||
|
||||
return std::make_shared<PCMTrack>(*segment);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user