mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-08 14:25:05 +00:00
Apple's GCR header varies between the Mac and the Apple II.
This commit is contained in:
@@ -79,7 +79,7 @@ std::shared_ptr<Track> AppleDSK::get_track_at_position(Track::Address address) {
|
|||||||
|
|
||||||
// Write the sectors.
|
// Write the sectors.
|
||||||
for(uint8_t c = 0; c < 16; ++c) {
|
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::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::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.
|
segment += Encodings::AppleGCR::six_and_two_sync(20); // Gap 3: 20 sync words.
|
||||||
|
@@ -64,7 +64,7 @@ Storage::Disk::PCMSegment AppleGCR::five_and_three_sync(int length) {
|
|||||||
return sync(length, 9);
|
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;
|
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.
|
// Apple headers are encoded using an FM-esque scheme rather than 6 and 2, or 5 and 3.
|
||||||
|
@@ -23,12 +23,6 @@ const uint8_t data_prologue[3] = {0xd5, 0xaa, 0xad};
|
|||||||
/// Describes the epilogue that ends both data sections and headers.
|
/// Describes the epilogue that ends both data sections and headers.
|
||||||
const uint8_t epilogue[3] = {0xde, 0xaa, 0xeb};
|
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 {
|
namespace AppleII {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -38,6 +32,12 @@ namespace AppleII {
|
|||||||
*/
|
*/
|
||||||
Storage::Disk::PCMSegment six_and_two_data(const uint8_t *source);
|
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 {
|
namespace Macintosh {
|
||||||
|
Reference in New Issue
Block a user