mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Corrections: data segments now correctly announce their number of bits, and tracks aren't oversized.
This commit is contained in:
parent
7f03f5d02f
commit
5b35c88be2
@ -40,7 +40,6 @@ 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) {
|
||||
segments.push_back(Encodings::AppleGCR::six_and_two_sync(10));
|
||||
@ -50,9 +49,11 @@ std::shared_ptr<Track> AppleDSK::get_track_at_position(Track::Address address) {
|
||||
segments.push_back(Encodings::AppleGCR::six_and_two_sync(10));
|
||||
}
|
||||
|
||||
// Pad if necessary.
|
||||
int encoded_length = (80 + 112 + 80 + 2848 + 80) * sectors_per_track_;
|
||||
segments.push_back(Encodings::AppleGCR::six_and_two_sync((50000 - encoded_length) >> 3));
|
||||
|
||||
if(encoded_length < 50000) {
|
||||
segments.push_back(Encodings::AppleGCR::six_and_two_sync((50000 - encoded_length) >> 3));
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
|
@ -135,6 +135,7 @@ Storage::Disk::PCMSegment AppleGCR::six_and_two_data(const uint8_t *source) {
|
||||
Storage::Disk::PCMSegment segment;
|
||||
|
||||
segment.data.resize(349);
|
||||
segment.number_of_bits = static_cast<unsigned int>(segment.data.size() * 8);
|
||||
|
||||
// Add the prologue and epilogue.
|
||||
segment.data[0] = header_prologue[0];
|
||||
@ -174,7 +175,7 @@ Storage::Disk::PCMSegment AppleGCR::six_and_two_data(const uint8_t *source) {
|
||||
|
||||
// Map six-bit values up to full bytes.
|
||||
for(std::size_t c = 0; c < 343; ++c) {
|
||||
segment.data[c] = six_and_two_mapping[segment.data[c]];
|
||||
segment.data[3 + c] = six_and_two_mapping[segment.data[3 + c]];
|
||||
}
|
||||
|
||||
return segment;
|
||||
|
Loading…
Reference in New Issue
Block a user