1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-04 18:29:40 +00:00

Switches to more realistic gaps.

This commit is contained in:
Thomas Harte 2018-06-09 13:06:45 -04:00
parent dde9b73a22
commit 28f2d331a8

View File

@ -72,19 +72,17 @@ std::shared_ptr<Track> AppleDSK::get_track_at_position(Track::Address address) {
Storage::Disk::PCMSegment segment;
const uint8_t track = static_cast<uint8_t>(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?