From a17e47fa43f24db1187ce66625eb39797bb56c32 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 15 Jun 2019 16:32:56 -0400 Subject: [PATCH] Apple's GCR header varies between the Mac and the Apple II. --- Storage/Disk/DiskImage/Formats/AppleDSK.cpp | 2 +- Storage/Disk/Encodings/AppleGCR/Encoder.cpp | 2 +- Storage/Disk/Encodings/AppleGCR/Encoder.hpp | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Storage/Disk/DiskImage/Formats/AppleDSK.cpp b/Storage/Disk/DiskImage/Formats/AppleDSK.cpp index 99c1b5e1d..209b57f8e 100644 --- a/Storage/Disk/DiskImage/Formats/AppleDSK.cpp +++ b/Storage/Disk/DiskImage/Formats/AppleDSK.cpp @@ -79,7 +79,7 @@ std::shared_ptr AppleDSK::get_track_at_position(Track::Address address) { // Write the sectors. for(uint8_t c = 0; c < 16; ++c) { - segment += Encodings::AppleGCR::header(is_prodos_ ? 0x01 : 0xfe, track, c); // Volume number is 0xfe for DOS 3.3, 0x01 for Pro-DOS. + segment += Encodings::AppleGCR::AppleII::header(is_prodos_ ? 0x01 : 0xfe, track, c); // Volume number is 0xfe for DOS 3.3, 0x01 for Pro-DOS. segment += Encodings::AppleGCR::six_and_two_sync(7); // Gap 2: 7 sync words. segment += Encodings::AppleGCR::AppleII::six_and_two_data(&track_data[logical_sector_for_physical_sector(c) * 256]); segment += Encodings::AppleGCR::six_and_two_sync(20); // Gap 3: 20 sync words. diff --git a/Storage/Disk/Encodings/AppleGCR/Encoder.cpp b/Storage/Disk/Encodings/AppleGCR/Encoder.cpp index e9611c78b..2e0811c42 100644 --- a/Storage/Disk/Encodings/AppleGCR/Encoder.cpp +++ b/Storage/Disk/Encodings/AppleGCR/Encoder.cpp @@ -64,7 +64,7 @@ Storage::Disk::PCMSegment AppleGCR::five_and_three_sync(int length) { return sync(length, 9); } -Storage::Disk::PCMSegment AppleGCR::header(uint8_t volume, uint8_t track, uint8_t sector) { +Storage::Disk::PCMSegment AppleGCR::AppleII::header(uint8_t volume, uint8_t track, uint8_t sector) { const uint8_t checksum = volume ^ track ^ sector; // Apple headers are encoded using an FM-esque scheme rather than 6 and 2, or 5 and 3. diff --git a/Storage/Disk/Encodings/AppleGCR/Encoder.hpp b/Storage/Disk/Encodings/AppleGCR/Encoder.hpp index 73753aef1..628c2aa65 100644 --- a/Storage/Disk/Encodings/AppleGCR/Encoder.hpp +++ b/Storage/Disk/Encodings/AppleGCR/Encoder.hpp @@ -23,12 +23,6 @@ const uint8_t data_prologue[3] = {0xd5, 0xaa, 0xad}; /// Describes the epilogue that ends both data sections and headers. const uint8_t epilogue[3] = {0xde, 0xaa, 0xeb}; -/*! - Produces the Apple-standard four-and-four per-sector header. This is the same - for both the 13- and 16-sector formats, and is 112 bits long. -*/ -Storage::Disk::PCMSegment header(uint8_t volume, uint8_t track, uint8_t sector); - namespace AppleII { /*! @@ -38,6 +32,12 @@ namespace AppleII { */ Storage::Disk::PCMSegment six_and_two_data(const uint8_t *source); +/*! + Produces the Apple II-standard four-and-four per-sector header. This is the same + for both the 13- and 16-sector formats, and is 112 bits long. +*/ +Storage::Disk::PCMSegment header(uint8_t volume, uint8_t track, uint8_t sector); + } namespace Macintosh {