mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-04 17:56:29 +00:00
Introduces interleaving of sector numbers.
This commit is contained in:
parent
c62db6665a
commit
5cd15147eb
@ -41,12 +41,17 @@ std::shared_ptr<Track> AppleDSK::get_track_at_position(Track::Address address) {
|
|||||||
// In either case below, the code aims for exactly 50,000 bits per track.
|
// In either case below, the code aims for exactly 50,000 bits per track.
|
||||||
if(sectors_per_track_ == 16) {
|
if(sectors_per_track_ == 16) {
|
||||||
// Write the sectors.
|
// Write the sectors.
|
||||||
for(uint8_t c = 0; c < 16; ++c) {
|
uint8_t sector_number_ = 0;
|
||||||
|
for(std::size_t c = 0; c < 16; ++c) {
|
||||||
segments.push_back(Encodings::AppleGCR::six_and_two_sync(10));
|
segments.push_back(Encodings::AppleGCR::six_and_two_sync(10));
|
||||||
segments.push_back(Encodings::AppleGCR::header(0, track, c));
|
segments.push_back(Encodings::AppleGCR::header(0, track, sector_number_));
|
||||||
segments.push_back(Encodings::AppleGCR::six_and_two_sync(10));
|
segments.push_back(Encodings::AppleGCR::six_and_two_sync(10));
|
||||||
segments.push_back(Encodings::AppleGCR::six_and_two_data(&track_data[c * 256]));
|
segments.push_back(Encodings::AppleGCR::six_and_two_data(&track_data[c * 256]));
|
||||||
segments.push_back(Encodings::AppleGCR::six_and_two_sync(10));
|
segments.push_back(Encodings::AppleGCR::six_and_two_sync(10));
|
||||||
|
|
||||||
|
// DOS and Pro DOS interleave sectors on disk, and they're represented in a disk
|
||||||
|
// image in physical order rather than logical. So that skew needs to be applied here.
|
||||||
|
sector_number_ = (sector_number_ + (is_prodos_ ? 8 : 7)) % 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pad if necessary.
|
// Pad if necessary.
|
||||||
|
@ -37,7 +37,8 @@ class AppleDSK: public DiskImage {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Storage::FileHolder file_;
|
Storage::FileHolder file_;
|
||||||
int sectors_per_track_;
|
int sectors_per_track_ = 16;
|
||||||
|
bool is_prodos_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user