diff --git a/Storage/Disk/DiskImage/Formats/AppleDSK.cpp b/Storage/Disk/DiskImage/Formats/AppleDSK.cpp index 50140f8c4..dcedd2fde 100644 --- a/Storage/Disk/DiskImage/Formats/AppleDSK.cpp +++ b/Storage/Disk/DiskImage/Formats/AppleDSK.cpp @@ -72,19 +72,17 @@ std::shared_ptr AppleDSK::get_track_at_position(Track::Address address) { Storage::Disk::PCMSegment segment; const uint8_t track = static_cast(address.position.as_int()); + // Write gap 1. + segment += Encodings::AppleGCR::six_and_two_sync(16); + // 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) { - segment += Encodings::AppleGCR::six_and_two_sync(10); segment += Encodings::AppleGCR::header(254, track, c); - segment += Encodings::AppleGCR::six_and_two_sync(10); + segment += Encodings::AppleGCR::six_and_two_sync(7); // Gap 2: 7 sync words. segment += Encodings::AppleGCR::six_and_two_data(&track_data[logical_sector_for_physical_sector(c) * 256]); - } - - // Pad if necessary. - if(segment.number_of_bits < 50000) { - segment += Encodings::AppleGCR::six_and_two_sync((50000 - segment.number_of_bits) / 10); + segment += Encodings::AppleGCR::six_and_two_sync(16); // Gap 3: 16 sync words. } } else { // TODO: 5 and 3, 13-sector format. If DSK actually supports it?