1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Introduces interleaving of sector numbers.

This commit is contained in:
Thomas Harte 2018-04-29 16:18:14 -04:00
parent c62db6665a
commit 5cd15147eb
2 changed files with 9 additions and 3 deletions

View File

@ -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.
if(sectors_per_track_ == 16) {
// 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::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_data(&track_data[c * 256]));
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.

View File

@ -37,7 +37,8 @@ class AppleDSK: public DiskImage {
private:
Storage::FileHolder file_;
int sectors_per_track_;
int sectors_per_track_ = 16;
bool is_prodos_ = false;
};
}